From b060822bd812e3a1ab65812b8ee9e52d8604d716 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Wed, 20 May 2026 19:12:10 +0900 Subject: [PATCH] selfhost/cmd/ww/main.ww: migrate visitadd strnode amalloc to alloc(T{...})! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- selfhost/cmd/ww/main.combined.ww | 4 +--- selfhost/cmd/ww/main.ww | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/selfhost/cmd/ww/main.combined.ww b/selfhost/cmd/ww/main.combined.ww index 72c0c519..db84b3d4 100644 --- a/selfhost/cmd/ww/main.combined.ww +++ b/selfhost/cmd/ww/main.combined.ww @@ -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; }; diff --git a/selfhost/cmd/ww/main.ww b/selfhost/cmd/ww/main.ww index c8b763b7..d17955c4 100644 --- a/selfhost/cmd/ww/main.ww +++ b/selfhost/cmd/ww/main.ww @@ -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; };