diff options
Diffstat (limited to 'xwrap.c')
| -rw-r--r-- | xwrap.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +#include <string.h> +#include <stdlib.h> + +#include "debug.h" + +void *xmalloc(size_t size) +{ + void *p; + + p = malloc(size); + if (p == NULL) + sys_err("malloc %zd bytes", size); + return p; +} + +char *xstrdup(const char *s) +{ + int len; + + len = strlen(s) + 1; + return memcpy(xmalloc(len), s, len); +} + |
