#include "mem.h" #include #include void *M(State *S, void *p, size_t old, size_t new) { if (new == 0) { free(p); return NULL; } else { void *x = realloc(p, new); if (x == NULL) { printf("out of memory! aaaaaaa!!!!!\n"); exit(42); } return x; } } Obj *alloc_obj(State *S, size_t sz, ObjTy oty) { Obj *o = M(S, NULL, 0, sz); o->oty = oty; return o; } size_t next_pwrof2(size_t x) { size_t p = 1; while (p < x) p <<= 1; return p; }