12 static char sccsid
[] = "@(#)ialloc.c 7.14";
17 #define alloc_t unsigned
21 #define NULLMAL(x) ((x) == NULL || (x) == MAL)
23 #define NULLMAL(x) ((x) == NULL)
27 extern char * calloc();
28 extern char * malloc();
29 extern char * realloc();
30 extern char * strcpy();
37 register char * result
;
41 result
= malloc((alloc_t
) n
);
42 return (result
== MAL
) ? NULL
: result
;
46 return malloc((alloc_t
) n
);
51 icalloc(int nelem
, int elsize
)
53 if (nelem
== 0 || elsize
== 0)
55 return calloc((alloc_t
) nelem
, (alloc_t
) elsize
);
59 irealloc(char *pointer
, int size
)
65 return realloc(pointer
, (alloc_t
) size
);
69 icatalloc(char *old
, char *new)
71 register char * result
;
72 register oldsize
, newsize
;
74 oldsize
= NULLMAL(old
) ? 0 : strlen(old
);
75 newsize
= NULLMAL(new) ? 0 : strlen(new);
76 if ((result
= irealloc(old
, oldsize
+ newsize
+ 1)) != NULL
)
78 (void) strcpy(result
+ oldsize
, new);
83 icpyalloc(char *string
)
85 return icatalloc((char *) NULL
, string
);