1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-23 07:31:23 +00:00
Files
amiga-tz/library/time_tzalloc.c

31 lines
828 B
C
Raw Normal View History

2015-07-25 23:35:51 +02:00
//--------------------------------------------------------------------------//
// This file is in the public domain, so clarified as of //
// 2009-05-17 by Arthur David Olson. //
//--------------------------------------------------------------------------//
2015-07-29 20:14:38 +02:00
#include "time_header.h"
2015-07-25 23:35:51 +02:00
timezone_t ASM tzalloc(REG(a0, char const *name))
{
struct state *sp;
2015-07-29 20:14:38 +02:00
unsigned long memsize;
2015-07-25 23:35:51 +02:00
2015-07-29 20:14:38 +02:00
if (name == NULL || name[0] == '\0') {
2015-07-25 23:35:51 +02:00
return NULL;
}
2015-07-29 20:14:38 +02:00
memsize = sizeof(struct state);
sp = (struct state*)AllocMem(memsize, MEMF_PUBLIC | MEMF_CLEAR);
2015-07-25 23:35:51 +02:00
if (sp) {
int err = zoneinit(sp, name);
if (err != 0) {
2015-07-29 20:14:38 +02:00
FreeMem(sp, memsize);
2015-07-25 23:35:51 +02:00
errno = err;
return NULL;
}
}
return (timezone_t)sp;
}