From 4917ae452a15ff4f32d97d215a99fdcfaab29d61 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 13:13:17 -0300 Subject: idioms #9, every catch unreachable this slice added is a fact of the code: each formats integers, literals, an error's name or a slice of a fixed array (the daemon's [128]u8 names, the cache's path_buf, main's cwd_buf, those two buffers now sized from their arrays), so all 39 stay, each with its reason on its own line Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/Db.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Db.zig') diff --git a/src/Db.zig b/src/Db.zig index f0bfc3f5..e5364b44 100644 --- a/src/Db.zig +++ b/src/Db.zig @@ -1114,8 +1114,8 @@ pub const Cache = struct { } }{ .cap = c.cap, .went = &went }) catch return; if (!went) return; - var new_buf: [4200]u8 = undefined; - const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch unreachable; // a path of 4096 fits 4200 + var new_buf: [c.path_buf.len + ".new".len]u8 = undefined; + const new = std.fmt.bufPrint(&new_buf, "{s}.new", .{c.path()}) catch unreachable; // path_buf's [4096]u8 and ".new" fit const cwd = std.Io.Dir.cwd(); const file = cwd.createFile(io, new, .{ .read = true, .truncate = true }) catch return; var buffer: std.Io.Writer.Allocating = .init(std.heap.c_allocator); -- cgit v1.3