diff options
author | HampusM <hampus@hampusmat.com> | 2022-01-01 13:51:51 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-01-01 13:51:51 +0100 |
commit | 1bed3ac57906b26ef05b25c2bc5c1dca424dba4a (patch) | |
tree | bd445f7800d27112b3c45199c797e8a048b0306b /src/position_stack.h | |
parent | 31c6239cb2fcb75aa2ec846ce88bd57a631bbd32 (diff) |
refactor: fix memory leaks & general improvements
Diffstat (limited to 'src/position_stack.h')
-rw-r--r-- | src/position_stack.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/position_stack.h b/src/position_stack.h index 82c1975..83fb98c 100644 --- a/src/position_stack.h +++ b/src/position_stack.h @@ -4,25 +4,27 @@ #define STACK_ERR_OVERFLOW 0xFFF01 #define STACK_ERR_UNDERFLOW 0xFFF02 -struct Position +typedef struct Position { int x; int y; -}; +} Position; -struct PositionStack +typedef struct PositionStack { int capacity; int top; - struct Position *items; -}; + Position *items; +} PositionStack; -struct PositionStack *create_pos_stack(int capacity); +PositionStack *pos_stack_create(int capacity); -void pos_stack_push(struct PositionStack *stack_pt, struct Position pos); +void pos_stack_destroy(PositionStack *pos_stack); -struct Position pos_stack_peek(struct PositionStack *stack_pt); +void pos_stack_push(PositionStack *pos_stack, Position pos); -struct Position pos_stack_pop(struct PositionStack *stack_pt); +Position pos_stack_peek(PositionStack *pos_stack); + +Position pos_stack_pop(PositionStack *pos_stack); #endif |