selfhost/cmd/ww/main.ww: migrate visitadd strnode amalloc to alloc(T{...})!

Phase 0 batch 4. Single typed-struct site in the driver. Retires the
32u64 over-size workaround on a 24-byte strnode (selfhost/CLAUDE.md
trap #1 — amalloc < struct corrupts the next slot).

14 other amalloc sites in ww/main.ww are runtime-N path/name buffers
(13 → task #8) and 3 fixed-max ".\0" prefix buffers (→ task #9).
wwdump/main.ww's 1 site is a runtime-N file-size buffer (→ task #8).

Verified 132/132 + 995_self_rebuild byte-identity.
This commit is contained in:
2026-05-20 19:12:10 +09:00
parent 65c92e2c8d
commit b060822bd8
2 changed files with 2 additions and 6 deletions

View File

@@ -1083,9 +1083,7 @@ fn visitseen(c: *expctx, path: str) bool = {
};
fn visitadd(c: *expctx, path: str) void = {
let n: *strnode = amalloc(c.a, 32u64): *strnode;
n.s = path;
n.snext = c.visit;
let n: *strnode = alloc(strnode{s=path, snext=c.visit})!;
c.visit = n;
};

View File

@@ -223,9 +223,7 @@ fn visitseen(c: *expctx, path: str) bool = {
};
fn visitadd(c: *expctx, path: str) void = {
let n: *strnode = amalloc(c.a, 32u64): *strnode;
n.s = path;
n.snext = c.visit;
let n: *strnode = alloc(strnode{s=path, snext=c.visit})!;
c.visit = n;
};