summaryrefslogtreecommitdiff
path: root/src/util/stack.h
diff options
context:
space:
mode:
authorTyler Murphy <tylerm@tylerm.dev>2023-05-04 16:10:37 -0400
committerTyler Murphy <tylerm@tylerm.dev>2023-05-04 16:10:37 -0400
commitb1364be7e271c5a080e29efcda209a190a82d6d9 (patch)
treefc64d1546e59b5ed1c2c204612b6181bc401c27f /src/util/stack.h
parentgrep (diff)
downloadlazysphere-b1364be7e271c5a080e29efcda209a190a82d6d9.tar.gz
lazysphere-b1364be7e271c5a080e29efcda209a190a82d6d9.tar.bz2
lazysphere-b1364be7e271c5a080e29efcda209a190a82d6d9.zip
ansii c
Diffstat (limited to '')
-rw-r--r--src/util/stack.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/util/stack.h b/src/util/stack.h
index 01a48e5..8d6fc80 100644
--- a/src/util/stack.h
+++ b/src/util/stack.h
@@ -1,7 +1,9 @@
-#pragma once
+#ifndef STACK_H
+#define STACK_H
+
+#include "shared.h"
#include <stddef.h>
-#include <stdbool.h>
struct Stack {
size_t size;
@@ -14,13 +16,7 @@ void stack_push(struct Stack* stack, void* data, size_t len);
void* stack_pop(struct Stack* stack, size_t len);
void stack_free(struct Stack* stack);
-inline void stack_push_int(struct Stack* stack, int value) {
- stack_push(stack, &value, sizeof(int));
-}
+void stack_push_int(struct Stack* stack, int value);
+bool stack_pop_int(struct Stack* stack, int* value);
-inline 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;
-}
+#endif