aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/cmd/cc/pp.c')
-rw-r--r--sys/cmd/cc/pp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/cmd/cc/pp.c b/sys/cmd/cc/pp.c
index 30a162b..5eed4b2 100644
--- a/sys/cmd/cc/pp.c
+++ b/sys/cmd/cc/pp.c
@@ -3,6 +3,17 @@
// -----------------------------------------------------------------------
// helper functions
+static
+void
+pushomit(Lexer *lx, string omit)
+{
+ if (lx->omit.len == lx->omit.cap) {
+ lx->omit.cap += 20;
+ lx->omit.path = realloc(lx->omit.path, lx->omit.cap*sizeof(*lx->omit.path));
+ }
+ lx->omit.path[lx->omit.len++] = omit;
+}
+
// NOTE: The iterator of lexer lx->b IS NOT reset.
// Its the caller's responsibility.
static
@@ -910,7 +921,7 @@ ppprag(Lexer *lx)
}
lx->b = lx->buf;
if (strcmp(s, "once") == 0) {
- pushomit(lx->io->path);
+ pushomit(lx, lx->io->path);
return 0;
}
Bad: