2 * malloc.c: safe wrappers around malloc, realloc, free, strdup
9 * smalloc should guarantee to return a useful pointer - Halibut
10 * can do nothing except die when it's out of memory anyway.
12 void *smalloc(int size
) {
16 fatal("out of memory");
21 * sfree should guaranteeably deal gracefully with freeing NULL
30 * srealloc should guaranteeably be able to realloc NULL
32 void *srealloc(void *p
, int size
) {
40 fatal("out of memory");
45 * dupstr is like strdup, but with the never-return-NULL property
46 * of smalloc (and also reliably defined in all environments :-)
48 char *dupstr(char *s
) {
49 char *r
= smalloc(1+strlen(s
));