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