diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-05-04 16:10:37 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-05-04 16:10:37 -0400 |
commit | b1364be7e271c5a080e29efcda209a190a82d6d9 (patch) | |
tree | fc64d1546e59b5ed1c2c204612b6181bc401c27f /src/util/stack.c | |
parent | grep (diff) | |
download | lazysphere-b1364be7e271c5a080e29efcda209a190a82d6d9.tar.gz lazysphere-b1364be7e271c5a080e29efcda209a190a82d6d9.tar.bz2 lazysphere-b1364be7e271c5a080e29efcda209a190a82d6d9.zip |
ansii c
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; +} |