diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-25 14:40:30 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-25 14:40:30 +0300 |
| commit | d0fa196751879965f6fb3a7426801ee66b434654 (patch) | |
| tree | 795948c5c7a7d3356f9f78f56f438b330db30f02 /stack.c | |
| parent | fcbe22e6bb4b461d9605c35df6705335cc515333 (diff) | |
| download | astar-d0fa196751879965f6fb3a7426801ee66b434654.tar.xz | |
Handle the stack overflow
Diffstat (limited to 'stack.c')
| -rw-r--r-- | stack.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |
