summaryrefslogtreecommitdiff
path: root/src/Handover.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 12:14:58 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commit4839c4b037d401393bbc87143d663e115c71242e (patch)
tree6d23e1cd9aaf89404dd53f03e6ada23588b42dcc /src/Handover.zig
parent77671575bd2f481651ea54e956ac5c7da8d63710 (diff)
downloadpardes-4839c4b037d401393bbc87143d663e115c71242e.tar.gz
pardes-4839c4b037d401393bbc87143d663e115c71242e.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/Handover.zig')
-rw-r--r--src/Handover.zig5
1 files changed, 3 insertions, 2 deletions
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;