aboutsummaryrefslogtreecommitdiff
path: root/src/position_stack.c
diff options
context:
space:
mode:
authorHampus <hampus@hampusmat.com>2021-12-18 18:56:20 +0100
committerHampus <hampus@hampusmat.com>2021-12-18 18:56:20 +0100
commit2f945e6c0edaf679d693cdfa61aeba62403dec9f (patch)
tree03079dc5f53edbbd0bb68d1ba5eb978f7c21709e /src/position_stack.c
parentc29486fecc272de43c11f4f26456094ce265b6f2 (diff)
refactor: clarify maze and stack logic
Diffstat (limited to 'src/position_stack.c')
-rw-r--r--src/position_stack.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/position_stack.c b/src/position_stack.c
index 3d546b8..90ace87 100644
--- a/src/position_stack.c
+++ b/src/position_stack.c
@@ -23,7 +23,7 @@ struct PositionStack *create_pos_stack(int capacity)
{
struct PositionStack *stack_pt = malloc(sizeof(struct PositionStack));
- stack_pt->max_size = capacity;
+ stack_pt->capacity = capacity;
stack_pt->top = -1;
stack_pt->items = malloc(sizeof(struct Position) * capacity);
@@ -34,7 +34,7 @@ struct PositionStack *create_pos_stack(int capacity)
void pos_stack_push(struct PositionStack *stack_pt, struct Position pos)
{
// Avoid a overflow by checking if the stack is full
- if (stack_pt->top == stack_pt->max_size - 1)
+ if (stack_pt->top == stack_pt->capacity - 1)
{
stack_error(STACK_ERR_OVERFLOW);
}
@@ -66,4 +66,4 @@ struct Position pos_stack_pop(struct PositionStack *stack_pt)
// Decrease the stack size by 1 and return the popped element
return stack_pt->items[stack_pt->top--];
-} \ No newline at end of file
+}