diff options
Diffstat (limited to 'mem.c')
-rw-r--r-- | mem.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ +#include "mem.h" + +#include <stdio.h> +#include <stdlib.h> + +void *M(void *p, size_t sz) { + if (sz == 0) { + free(p); + return NULL; + } else { + void *x = realloc(p, sz); + if (x == NULL) { + printf("out of memory! aaaaaaa!!!!!\n"); + exit(42); + } + return x; + } +} |