/* * This is how realloc SHOULD work according to ANSI and ISO * standards for C. Unfortunately, Sun's C libraries are not quite * up to that... :( */ static void *safe_realloc (void *x, size_t s) { if (x == NULL) if (s == 0) return NULL; else return malloc (s); else if (s == 0) { free (x); return NULL; } else return realloc (x, s); }