1 /* Xmalloc --- never failing wrappers for malloc() & friends.
2 Copyright (C) 1995, 1996 Markus Armbruster */
6 /* @@@ ToDo: replace this file with the one from liberty.
7 [reimplement xstrdup, ... ] */
20 (xmalloc) (size_t size)
22 void *res = malloc (size);
30 (xrealloc) (void *ptr, size_t size)
32 /* ANSI blesses realloc (0, x) but SunOS chokes on it */
33 void *res = ptr ? realloc (ptr, size) : malloc (size);
41 (xstrdup) (const char *str)
43 size_t len = strlen (str) + 1;
44 return memcpy ((xmalloc) (len), str, len);
51 panic ("out of memory");