summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-05-04 11:49:29 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-05-04 11:49:29 -0400
commit0908a71ac806d1a881abd9a27014413bab256930 (patch)
tree7033f3efc231fdd4dbd97921ff2b46e868842aff
parente0ce255661e892086d585f8148d30b01dc3bbc95 (diff)
fixed bug with f(f(x)) solution
-rw-r--r--allocator.c2
-rw-r--r--eval.c4
2 files changed, 1 insertions, 5 deletions
diff --git a/allocator.c b/allocator.c
index 98005ef..a731928 100644
--- a/allocator.c
+++ b/allocator.c
@@ -25,7 +25,7 @@ static void *err_malloc(size_t bytes);
static void *err_calloc(size_t n, size_t sz);
static void *err_realloc(void *prev, size_t new_size);
#ifdef TOC_DEBUG
-#define NO_ALLOCATOR 1 /* useful for debugging; valgrind checks writing past the end of a malloc, but that won't work with an allocator */
+//#define NO_ALLOCATOR 1 /* useful for debugging; valgrind checks writing past the end of a malloc, but that won't work with an allocator */
#endif
/* number of bytes a page hold, not including the header */
#define PAGE_BYTES (16384 - sizeof(Page))
diff --git a/eval.c b/eval.c
index e14e333..0271fb0 100644
--- a/eval.c
+++ b/eval.c
@@ -1460,7 +1460,6 @@ static Status eval_expr(Evaluator *ev, Expression *e, Value *v) {
Declaration *params = fn->params;
Expression *arg = e->call.arg_exprs;
/* @OPTIM: figure out how much memory parameters use, then allocate that much space (possibly with alloca)? */
- Value **to_free = NULL;
arr_foreach(params, Declaration, p) {
int idx = 0;
bool multiple_idents = arr_len(p->idents) > 1;
@@ -1489,7 +1488,6 @@ static Status eval_expr(Evaluator *ev, Expression *e, Value *v) {
}
}
arr_add(p->val_stack, pval);
- arr_add(to_free, pval);
}
arr_foreach(fn->ret_decls, Declaration, d) {
@@ -1552,8 +1550,6 @@ static Status eval_expr(Evaluator *ev, Expression *e, Value *v) {
}
arr_foreach(fn->params, Declaration, p)
decl_remove_val(p);
- arr_foreach(to_free, ValuePtr, p)
- free(*p);
arr_foreach(fn->ret_decls, Declaration, d)
decl_remove_val(d);
} break;