aboutsummaryrefslogtreecommitdiff
path: root/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'stack.c')
-rw-r--r--stack.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/stack.c b/stack.c
index bcdfbd3..cf169c5 100644
--- a/stack.c
+++ b/stack.c
@@ -7,14 +7,16 @@ PositionStack ps_new(void) {
return ps;
}
-int ps_push(PositionStack ps, Position pos) {
- ps.arr[ps.top] = pos;
- ps.top += 1;
+int ps_push(PositionStack *ps, Position pos) {
+ //TODO: check for stack overflow
+ ps->arr[ps->top] = pos;
+ ps->top += 1;
+ return 0;
}
-Position ps_pop(PositionStack ps) {
- ps.top -= 1;
- return ps.arr[ps.top];
+Position ps_pop(PositionStack *ps) {
+ ps->top -= 1;
+ return ps->arr[ps->top];
}
Position ps_peek(PositionStack ps) {