summaryrefslogtreecommitdiff
path: root/src/host_io.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 14:39:47 -0300
committerGabriel Schneider <[email protected]>2026-11-06 14:56:36 -0300
commite8e7ed956f3914a3790e980df0862b26c30bd611 (patch)
tree53d3247c594717f79745ad20c5dd23bf16ed59ea /src/host_io.zig
parenta821fe82d8de3d407ebe104358b97719bd983727 (diff)
downloadpardes-e8e7ed956f3914a3790e980df0862b26c30bd611.tar.gz
pardes-e8e7ed956f3914a3790e980df0862b26c30bd611.zip
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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/host_io.zig')
-rw-r--r--src/host_io.zig8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/host_io.zig b/src/host_io.zig
index 6ce26e41..9e0292b3 100644
--- a/src/host_io.zig
+++ b/src/host_io.zig
@@ -231,8 +231,8 @@ pub const Adoptions = struct {
/// takes this pty instead of forking a shell (`take`).
pub fn adoptShell(a: *Adoptions, core: *pardes.Pardes, pid: libc.pid_t, fd: c_int) void {
if (pid == 0) {
- var buf: [96]u8 = undefined;
- return core.setMessage(core.view().active, if (a.taken == 0) "Adopt: no shell of a session that died is waiting" else std.fmt.bufPrint(&buf, "Adopt: {d} shell{s} taken in; what they showed is gone", .{ a.taken, if (a.taken == 1) "" else "s" }) catch unreachable); // a count fits 96
+ var buf: pardes.Kind.Buf(96) = .{};
+ return core.setMessage(core.view().active, if (a.taken == 0) "Adopt: no shell of a session that died is waiting" else buf.print("Adopt: {d} shell{s} taken in; what they showed is gone", .{ a.taken, if (a.taken == 1) "" else "s" }));
}
if (a.len < a.list.len) {
a.list[a.len] = .{ .pid = pid, .fd = fd, .pane = null };
@@ -246,8 +246,8 @@ pub const Adoptions = struct {
}
// No room for it: its master goes, and the shell with this session.
_ = libc.close(fd);
- var buf: [96]u8 = undefined;
- core.setMessage(core.view().active, std.fmt.bufPrint(&buf, "Adopt: no room for shell {d}; it ends with this session", .{pid}) catch unreachable); // a pid fits 96
+ var buf: pardes.Kind.Buf(96) = .{};
+ core.setMessage(core.view().active, buf.print("Adopt: no room for shell {d}; it ends with this session", .{pid}));
}
/// The adopted shell pane `pane`'s spawn takes, off the list.