aboutsummaryrefslogtreecommitdiff
path: root/stack.c
diff options
context:
space:
mode:
Diffstat (limited to 'stack.c')
-rw-r--r--stack.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stack.c b/stack.c
index c915afd..1edb5c5 100644
--- a/stack.c
+++ b/stack.c
@@ -1,5 +1,8 @@
#include "stack.h"
#include "structs.h"
+#include "error.h"
+#include "curses.h" /* Required by error.h */
+#include "stdio.h" /* Required by error.h */
PositionStack ps_new(void) {
PositionStack ps;
@@ -8,7 +11,7 @@ PositionStack ps_new(void) {
}
int ps_push(PositionStack *ps, Position pos) {
- /*TODO: check for stack overflow */
+ if (ps->top >= STACK_SIZE) return -1;
ps->arr[ps->top] = pos;
ps->top += 1;
return 0;