aboutsummaryrefslogtreecommitdiffhomepage
path: root/c.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-18 18:12:19 +0200
committerlemon <lsof@mailbox.org>2025-10-18 18:12:19 +0200
commit99adb48d94c59cb2e5701ca39d7c40d4f63459b3 (patch)
treebe3c432db54dd7f4e1ceab70848543bba1a4ead8 /c.c
parentffca6b54a9654005a121c3557bb8b245ae65ce55 (diff)
#pragma once
Diffstat (limited to 'c.c')
-rw-r--r--c.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/c.c b/c.c
index 58a3147..ac3b863 100644
--- a/c.c
+++ b/c.c
@@ -44,7 +44,7 @@ lexc(struct comp *cm, struct token *tk)
tk->s = memcpy(alloc(&cm->exarena, tk->len + rest.n, 1), tk->s, tk->len);
memcpy((char *)tk->s + tk->len, rest.p, rest.n);
tk->len += rest.n;
- } else if (tk->wide && targ_primsizes[targ_wchartype] == 2) {
+ } else if (tk->wide == 1) {
tk->ws16 = memcpy(alloc(&cm->exarena, tk->len + rest.n*2, 2), tk->ws16, tk->len*2);
memcpy((short *)tk->s + tk->len, rest.p, rest.n);
tk->len += rest.n * 2;
@@ -4022,13 +4022,17 @@ initcm(struct comp *cm, const char *file)
{
enum { N = 1<<12 };
static union { char m[sizeof(struct arena) + N]; struct arena *_align; } amem[2];
- const char *err = initlexer(&cm->lx, NULL, file);
- if (err)
+ const char *err;
+ switch (initlexer(&cm->lx, &err, file)) {
+ default: assert(0);
+ case LXERR:
fatal(NULL, "Cannot open %'s: %s", file, err);
- cm->fnarena = (void *)amem[0].m;
- cm->fnarena->cap = N;
- cm->exarena = (void *)amem[1].m;
- cm->exarena->cap = N;
+ case LXOK:
+ cm->fnarena = (void *)amem[0].m;
+ cm->fnarena->cap = N;
+ cm->exarena = (void *)amem[1].m;
+ cm->exarena->cap = N;
+ }
}
void