*/
#include "xmalloc.h"
+
#include <stdio.h>
+#include <string.h>
/* Allocate memory using malloc(), checking for errors.
*
return ret;
}
+
+char *
+xstrdup (const char *s)
+{
+ char *ret;
+
+ ret = strdup (s);
+ if (ret == NULL) {
+ fprintf (stderr, "Error: out of memory. Exiting.\n");
+ exit (1);
+ }
+
+ return ret;
+}