diff options
| author | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-28 19:33:49 +0300 |
|---|---|---|
| committer | Kirill Petrashin <kirill8201@yandex.ru> | 2026-03-28 19:33:49 +0300 |
| commit | 1f0dd604952e39d030367b2bbf45b69f8c63cc5b (patch) | |
| tree | a1389804dbb9301a6691704e4c5c0eb829df4a4b /stack.c | |
| parent | 5b623c0a31d6732dd03ba8db80004e5468bc08c3 (diff) | |
| download | astar-1f0dd604952e39d030367b2bbf45b69f8c63cc5b.tar.xz | |
Allow resizing the map + some other stuff
Diffstat (limited to 'stack.c')
| -rw-r--r-- | stack.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -18,11 +18,13 @@ int ps_push(PositionStack *ps, Position pos) { } Position ps_pop(PositionStack *ps) { + if (ps->top == 0) error("Stack underflow\n"); ps->top -= 1; return ps->arr[ps->top]; } Position ps_peek(PositionStack ps) { + if (ps.top == 0) error("Stack underflow\n"); return ps.arr[ps.top - 1]; } |
