3 static char elsieid[] = "@(#)ialloc.c 8.24";
4 #endif /* !defined NOID */
5 #endif /* !defined lint */
12 #define NULLMAL(x) ((x) == NULL || (x) == MAL)
13 #endif /* defined MAL */
15 #define NULLMAL(x) ((x) == NULL)
16 #endif /* !defined MAL */
18 #define nonzero(n) (((n) == 0) ? 1 : (n))
20 char * icalloc P((int nelem, int elsize));
21 char * icatalloc P((char * old, const char * new));
22 char * icpyalloc P((const char * string));
23 char * imalloc P((int n));
24 void * irealloc P((void * pointer, int size));
25 void ifree P((char * pointer));
32 register char * result;
34 result = malloc((alloc_size_T) nonzero(n));
35 return NULLMAL(result) ? NULL : result;
36 #endif /* defined MAL */
38 return malloc((alloc_size_T) nonzero(n));
39 #endif /* !defined MAL */
43 icalloc(nelem, elsize)
47 if (nelem == 0 || elsize == 0)
49 return calloc((alloc_size_T) nelem, (alloc_size_T) elsize);
53 irealloc(pointer, size)
59 return realloc((genericptr_T) pointer, (alloc_size_T) nonzero(size));
65 const char * const new;
67 register char * result;
68 register int oldsize, newsize;
70 newsize = NULLMAL(new) ? 0 : strlen(new);
73 else if (newsize == 0)
75 else oldsize = strlen(old);
76 if ((result = irealloc(old, oldsize + newsize + 1)) != NULL)
78 (void) strcpy(result + oldsize, new);
84 const char * const string;
86 return icatalloc((char *) NULL, string);