summaryrefslogtreecommitdiff
path: root/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/mem.c b/mem.c
new file mode 100644
index 0000000..6e0bc1b
--- /dev/null
+++ b/mem.c
@@ -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;
+ }
+}