4 * Memory routines with out-of-memory checking.
6 * Copyright 1996-2003 Glyph & Cog, LLC
19 * Same as malloc, but prints error message and exits if malloc()
22 extern void *gmalloc(int size);
25 * Same as realloc, but prints error message and exits if realloc()
26 * returns NULL. If <p> is NULL, calls malloc instead of realloc().
28 extern void *grealloc(void *p, int size);
31 * These are similar to gmalloc and grealloc, but take an object count
32 * and size. The result is similar to allocating nObjs * objSize
33 * bytes, but there is an additional error check that the total size
34 * doesn't overflow an int.
36 extern void *gmallocn(int nObjs, int objSize);
37 extern void *greallocn(void *p, int nObjs, int objSize);
40 * Same as free, but checks for and ignores NULL pointers.
42 extern void gfree(void *p);
46 * Report on unfreed memory.
48 extern void gMemReport(FILE *f);
54 * Allocate memory and copy a string into it.
56 extern char *copyString(char *s);