#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "gettext.h"
+#include "xmalloc.h"
static void
xmalloc_default_error_handler(int err)
{
- fprintf(stderr, "Memory allocation failure: %s\n", strerror(err));
+ fprintf(stderr, _("Memory allocation failure: %s\n"), strerror(err));
exit(EXIT_FAILURE);
}
return ptr;
}
+char *
+xstrdup(const char *s)
+{
+ size_t len = strlen(s);
+ void *new;
+
+ new = xmalloc_inc(len, 1);
+ if(new == NULL)
+ return NULL;
+
+ return (char *)memcpy(new, s, len + 1);
+}
+