diff options
Diffstat (limited to '')
-rw-r--r-- | src/util/stack.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/stack.c b/src/util/stack.c index 15d5a8e..acffc1a 100644 --- a/src/util/stack.c +++ b/src/util/stack.c @@ -30,3 +30,14 @@ void* stack_pop(struct Stack* stack, size_t len) { void stack_free(struct Stack *stack) { free(stack->data); } + +void stack_push_int(struct Stack *stack, int value) { + stack_push(stack, &value, sizeof(int)); +} + +bool stack_pop_int(struct Stack *stack, int* value) { + void* d = stack_pop(stack, sizeof(int)); + if (d == NULL) return false; + *value = *(int*)(d); + return true; +} |