aboutsummaryrefslogtreecommitdiff
path: root/pop.c
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2026-09-05 17:14:53 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2026-09-26 03:41:55 +0200
commit3c0819236e4f07c8f57aaf1ca46d0d68aa761558 (patch)
treebd8b57cf5420cabc4ec29815052df545b55026f9 /pop.c
parenta3f56c76444fee090e62a59f257ed5f60b4e552b (diff)
downloadprc-3c0819236e4f07c8f57aaf1ca46d0d68aa761558.tar.gz
Move source to src/prc1
Diffstat (limited to 'pop.c')
-rw-r--r--pop.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/pop.c b/pop.c
deleted file mode 100644
index ba2f3a1..0000000
--- a/pop.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "prv.h"
-#include <stdlib.h>
-
-int pop(const struct lex *l, struct prv *p)
-{
- size_t n;
- struct pos *pos = NULL;
-
- if (!p->n)
- {
- fprintf(stderr, "%s: underflow\n", __func__);
- return -1;
- }
- else if (!(n = p->n - 1))
- {
- free(p->pos);
- p->pos = NULL;
- }
- else if (!(pos = realloc(p->pos, n * sizeof *pos)))
- {
- perror("realloc(3)");
- return -1;
- }
-
- p->pos = pos;
- p->n = n;
-
- if (p->n)
- {
- const struct pos *old = &p->pos[--p->i];
-
- if (old->end && old->end(l, p))
- return -1;
- }
-
- return 0;
-}