3 static char elsieid
[] = "@(#)ialloc.c 8.29";
4 #endif /* !defined NOID */
5 #endif /* !defined lint */
11 #define nonzero(n) (((n) == 0) ? 1 : (n))
17 return malloc((size_t) nonzero(n
));
21 icalloc(nelem
, elsize
)
25 if (nelem
== 0 || elsize
== 0)
27 return calloc((size_t) nelem
, (size_t) elsize
);
31 irealloc(pointer
, size
)
37 return realloc((void *) pointer
, (size_t) nonzero(size
));
43 const char * const new;
45 register char * result
;
46 register int oldsize
, newsize
;
48 newsize
= (new == NULL
) ? 0 : strlen(new);
51 else if (newsize
== 0)
53 else oldsize
= strlen(old
);
54 if ((result
= irealloc(old
, oldsize
+ newsize
+ 1)) != NULL
)
56 (void) strcpy(result
+ oldsize
, new);
62 const char * const string
;
64 return icatalloc((char *) NULL
, string
);