diff options
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -13,7 +13,12 @@ void *M(void *p, size_t sz) { free(p); return NULL; } else { - return realloc(p, sz); + void *x = realloc(p, sz); + if (x == NULL) { + printf("out of memory! aaaaaaa!!!!!\n"); + exit(42); + } + return x; } } @@ -107,7 +112,7 @@ void runvm(Chunk *ch) { Val a = POP(); \ if (!IS_NUM(a) || !IS_NUM(b)) { \ printf("can't do arithmetic on %s and %s\n", \ - valty_str(a.ty), valty_str(b.ty)); \ + valty_str(a), valty_str(b)); \ goto done; \ } \ PUSH(VAL_NUM(AS_NUM(a) OP AS_NUM(b))); \ |