From 4839c4b037d401393bbc87143d663e115c71242e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 12:14:58 -0300 Subject: idioms #2, formats that cannot overflow say so: a bufPrint or a fixed writer whose buffer provably holds the text (numbers, a 128-byte name, a short phrase) is catch unreachable with its reason, not a catch "" or a stand-in sentence nobody can reach, and dump.check takes its 256-byte why as such Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Handover.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/Handover.zig') diff --git a/src/Handover.zig b/src/Handover.zig index 23baf4ad..e9e0622b 100644 --- a/src/Handover.zig +++ b/src/Handover.zig @@ -217,7 +217,8 @@ fn dumpCarried(p: *Pardes, kind: Kind, at: usize, ids: []const usize, seq: u32) } }{ .w = &w, .value = &value }); var name: [32]u8 = undefined; - return pardes.Db.image(p.gpa, std.fmt.bufPrint(&name, "handover-{d}", .{seq}) catch "handover", buf.written(), w.blobs.items, ids.len); + // "handover-" and a u32 fit 32. + return pardes.Db.image(p.gpa, std.fmt.bufPrint(&name, "handover-{d}", .{seq}) catch unreachable, buf.written(), w.blobs.items, ids.len); } /// Whether `bytes` are a handover's dump (`dumpCarried`'s, or an older @@ -413,7 +414,7 @@ fn carry(io: std.Io, job: *Job) void { return job.post(job.post_ctx, job.seq, false, "the new window ended before it was up"); if (ninep_io.Client.readLimit(job.gpa, entry, "status", "status", 256)) |status| { job.gpa.free(status); - return job.post(job.post_ctx, job.seq, true, std.fmt.bufPrint(&words, "a new window (pardes/{d})", .{pid}) catch "a new window"); + return job.post(job.post_ctx, job.seq, true, std.fmt.bufPrint(&words, "a new window (pardes/{d})", .{pid}) catch unreachable); // a pid fits 256 } else |_| {} io.sleep(.fromMilliseconds(50), .awake) catch { for_child = true; -- cgit v1.3