summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/vm.c b/vm.c
index 70f065b..f7887d3 100644
--- a/vm.c
+++ b/vm.c
@@ -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))); \