]>
git.saurik.com Git - apple/system_cmds.git/blob - system_cmds-597.1.1/zic.tproj/ialloc.c
3 static const char elsieid
[] = "@(#)ialloc.c 8.29";
4 #endif /* !defined NOID */
5 #endif /* !defined lint */
8 static const char rcsid
[] =
9 "$FreeBSD: src/usr.sbin/zic/ialloc.c,v 1.6 2000/11/28 18:18:56 charnier Exp $";
16 #define nonzero(n) (((n) == 0) ? 1 : (n))
22 return malloc((size_t) nonzero(n
));
26 icalloc(nelem
, elsize
)
30 if (nelem
== 0 || elsize
== 0)
32 return calloc((size_t) nelem
, (size_t) elsize
);
36 irealloc(pointer
, size
)
42 return realloc((void *) pointer
, (size_t) nonzero(size
));
48 const char * const new;
50 register char * result
;
51 register int oldsize
, newsize
;
53 newsize
= (new == NULL
) ? 0 : strlen(new);
56 else if (newsize
== 0)
58 else oldsize
= strlen(old
);
59 if ((result
= irealloc(old
, oldsize
+ newsize
+ 1)) != NULL
)
61 (void) strcpy(result
+ oldsize
, new);
67 const char * const string
;
69 return icatalloc((char *) NULL
, string
);