aboutsummaryrefslogtreecommitdiffhomepage
path: root/c/lex.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-22 08:58:43 +0100
committerlemon <lsof@mailbox.org>2025-12-22 08:58:43 +0100
commit6bb6fb79350945951b26864d2a8c433053bbca0d (patch)
treeb92f9ea88f5d6aae2b798d6035ce1d066e1ed917 /c/lex.c
parent6fc94fd3f7edad42e77426153f9933376b621142 (diff)
c: Fix some dumb uses of initialized stuff
Can't figure out what's wrong with the change to struct expr from 9721d6ba40 but it makes valgrind complain and causes miscompilation of the compiler itself..
Diffstat (limited to 'c/lex.c')
-rw-r--r--c/lex.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/c/lex.c b/c/lex.c
index 9b6de51..b08a704 100644
--- a/c/lex.c
+++ b/c/lex.c
@@ -545,11 +545,12 @@ Begin:
--lx->chrbuf0;
if (lx->chrbuf0 + MAXLITLEN >= countof(lx->chrbuf))
fillchrbuf(lx);
- uchar *p = &lx->chrbuf[lx->chrbuf0];
int n = 1;
+ uchar *p = &lx->chrbuf[lx->chrbuf0];
for (; isppnum(p[n-1], p[n]); ++n) {
- if (n >= MAXLITLEN) TooLong: {
+ if (n >= MAXLITLEN) {
lx->chridx = lx->chridxbuf[lx->chrbuf0+n-1];
+ TooLong:
fatal(&(struct span) {{ idx, lx->chridx - idx, lx->fileid }},
"token is too long");
}
@@ -571,7 +572,10 @@ Begin:
uchar *p = &lx->chrbuf[lx->chrbuf0];
int n = 1;
for (; !aissep(p[n]); ++n) {
- if (n >= MAXLITLEN) goto TooLong;
+ if (n >= MAXLITLEN) {
+ lx->chridx = lx->chridxbuf[lx->chrbuf0+n-1];
+ goto TooLong;
+ }
}
tk->blue = 0;
tk->len = n;