From e8e7ed956f3914a3790e980df0862b26c30bd611 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 14:39:47 -0300 Subject: idioms #20, the bound in the type or the cut handled: of the 166 `catch unreachable` the pass kept, 64 stay where a reader checks the bound without arithmetic (an integer's digits, a declared field's size, and now the daemon's pid lists and the clock's two-digit fields written in their types), 69 texts print through Kind.Buf at their old size, 31 handle the failure once (a print into ename cut at its 320, paneText's line cut where its buffer fills, a log record or mouse report dropped rather than cut short, the question's letters that fit), Newcol's and pane/new's refusals are comptime strings, and dropUnsaved's too-long scratch name is null, not an empty sentinel Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/dump.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/dump.zig') diff --git a/src/dump.zig b/src/dump.zig index 06721be1..08736c84 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -254,7 +254,7 @@ pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: *[256]u8) !void { error.NoDump => "it holds no dump", error.OutOfMemory => "out of memory", else => "it is no dump of pardes's", - }}) catch unreachable; // a literal or an error's name fits 255 + }}) catch why[0 .. why.len - 1]; // cut at 255 why[said.len] = 0; return err; }; @@ -266,7 +266,7 @@ pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: *[256]u8) !void { error.BadDump => "it does not begin as one", error.EndOfDump => "it is cut short", else => @errorName(err), - }}) catch unreachable; // a literal or an error's name fits 255 + }}) catch why[0 .. why.len - 1]; // cut at 255 why[said.len] = 0; return err; }; -- cgit v1.3