diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-05 12:11:33 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-05 12:11:33 -0800 |
commit | 346507f767d71c69e55b9f663449eb39e1bc7e54 (patch) | |
tree | 5b05f645d4dab681a64efb5ce8801c6442cdd624 /src/stack.c | |
parent | c090ab2336d4f2f8536ca47a17f3e689299ea45e (diff) |
lists evaluate for non built-in functions
Diffstat (limited to 'src/stack.c')
-rw-r--r-- | src/stack.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/stack.c b/src/stack.c index 4898d83..21a8b35 100644 --- a/src/stack.c +++ b/src/stack.c @@ -1,9 +1,10 @@ #include "./include/stack.h" #include "./include/hash_table.h" #include "./include/macros.h" +#include <stdio.h> #include <stdlib.h> -stack_t *init_stack(int ht_size) { +stack_t *init_stack() { stack_t *s = (stack_t *)malloc(sizeof(stack_t)); if (s == NULL) die("malloc on stack"); @@ -16,9 +17,9 @@ void stack_push(stack_t *s, hash_table_t *h) { if (s->stack == NULL) { s->stack = malloc(sizeof(hash_table_t *)); if (s->stack == NULL) - die("malloc on stack within stack"); + die("malloc on stack within stack_push"); } else { - s->stack = realloc(s->stack, 2 + s->cur); + s->stack = realloc(s->stack, (2 + s->cur) * sizeof(hash_table_t *)); } s->cur++; s->stack[s->cur] = h; |