From faa68dd74eacd001e3421b8baef7fe6564fb4f2b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 30 Oct 2026 17:00:14 -0300 Subject: web: the build links no libc, so what is the C heap's is a hosted build's alone: terminal.create takes emulator_gpa (std.heap.c_allocator) only in a hosted build, as only one has a screen-state replica, and walk's blob lists (a replica client's, a join's) only with libc; `zig build web` failed on main at terminal.zig:601, and at walk.zig:115 behind it; it builds, and test/web-snapshots/touch.mjs passes (the driver's own CDP-deadline test fails as on main, untouched) Co-Authored-By: Claude Opus 5.5 --- src/terminal.zig | 3 ++- src/walk.zig | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/terminal.zig b/src/terminal.zig index 63ce4f36..01a9777e 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -878,7 +878,8 @@ pub fn create(gpa: std.mem.Allocator, cols: u16, rows: u16) !*Pane { const pane = try createDoc(gpa, cols, rows); errdefer gpa.destroy(pane); if (comptime !enabled) return pane; - const own = if (pardes.tape.screenReplica()) emulator_gpa else gpa; + // A screen-state replica is a hosted build's: the web has no C heap. + const own = if (comptime pardes.hosted) (if (pardes.tape.screenReplica()) emulator_gpa else gpa) else gpa; const state = try own.create(State); errdefer own.destroy(state); state.gpa = own; diff --git a/src/walk.zig b/src/walk.zig index 88f62736..c5a6e7a2 100644 --- a/src/walk.zig +++ b/src/walk.zig @@ -111,12 +111,14 @@ fn hashBlob(comptime E: type, items: []const E, h: *Hasher) void { const b = blob_words.get(addr) orelse break :kept null; break :kept if (b.len == items.len) b.word else null; } else null; - if (blobs_out) |list| { + // The lists are the C heap's (a replica client's, a session's join), + // which a build with no libc (the web) has neither of. + if (comptime builtin.link_libc) if (blobs_out) |list| { list.append(std.heap.c_allocator, std.mem.sliceAsBytes(items)) catch {}; break :word 0; - } + }; if (!rehash) if (kept) |w| break :word w; - if (E == u8) if (unhashed_out) |list| if (kept == null) { + if (comptime builtin.link_libc) if (E == u8) if (unhashed_out) |list| if (kept == null) { list.append(std.heap.c_allocator, items) catch {}; break :word 0; }; -- cgit v1.3