summaryrefslogtreecommitdiff
path: root/mem.c
blob: 6e0bc1bcbecbe471f67b3b1b9b886f0fee4acecb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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;
	}
}