#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "xmalloc.h"
static void
xmalloc_default_error_handler(int err)
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);
+}
+