Which is analagous to xmalloc and friends.
/* Allocate memory using malloc(), checking for errors.
*
/* Allocate memory using malloc(), checking for errors.
*
+
+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;
+}
((size) && (unsigned) (nmemb) >= INT32_MAX / (unsigned) (size) ? NULL : \
xrealloc(ptr, (unsigned) (nmemb) * (unsigned) (size)))
((size) && (unsigned) (nmemb) >= INT32_MAX / (unsigned) (size) ? NULL : \
xrealloc(ptr, (unsigned) (nmemb) * (unsigned) (size)))
+char *
+xstrdup (const char *s);
+