summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-21 14:35:15 -0300
committerGabriel Schneider <[email protected]>2026-10-22 10:03:15 -0300
commitbc3d18d27f9fc1155db7fac3946c4d38774f9e65 (patch)
tree9178ce95952797f8a78b16c2b805e53368efb35a /src/ninep/tree.zig
parent1ecb9b720840ea8e4753823fa8cddcf5d6a3a4d2 (diff)
downloadpardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.tar.gz
pardes-bc3d18d27f9fc1155db7fac3946c4d38774f9e65.zip
Build with Zig 0.17
ghostty, libvaxis and uucode move to ghostty's 0.17 pins, cloud9 to its 0.17 main, SDL to castholm's release-3.4.x (3.4.18), zstbi and tree-sitter to forks with 0.17 build files (see build.zig.zon). A bare zig build copies the binaries into ~/.local/bin (-Dhome-install=false leaves it out): 0.17 keeps the prefix from build scripts. A terminal's edited copy goes when the program clears the screen. tinywin.snap is gone; perf baselines are re-recorded. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index eedab43b..5678832b 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -509,7 +509,7 @@ pub fn fitErr(text: []const u8, out: []u8) []const u8 {
test "a reason past 128 bytes keeps its end: the path in it gives up its middle" {
var out: [128]u8 = undefined;
- const long = "Save /home/someone/projects/" ++ "deep/" ** 30 ++ "file.txt: no such directory";
+ const long = "Save /home/someone/projects/" ++ std.mem.asBytes(&@as([30][5]u8, @splat("deep/".*))) ++ "file.txt: no such directory";
const fit = fitErr(long, &out);
try testing.expect(fit.len <= 128);
try testing.expect(std.mem.startsWith(u8, fit, "Save /home/someone/"));
@@ -517,7 +517,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle"
try testing.expect(std.mem.indexOf(u8, fit, "…") != null);
try testing.expect(std.unicode.utf8ValidateSlice(fit));
// No path: the whole text's middle goes, the end stays.
- const words = "why " ** 40 ++ "the reason";
+ const words = std.mem.asBytes(&@as([40][4]u8, @splat("why ".*))) ++ "the reason";
try testing.expect(std.mem.endsWith(u8, fitErr(words, &out), "the reason"));
try testing.expectEqualStrings("short", fitErr("short", &out));
// Through the tree: a look at a long ./ name not there, a miss, says
@@ -525,7 +525,7 @@ test "a reason past 128 bytes keeps its end: the path in it gives up its middle"
const p = try th.withFile(testing.allocator, "x\n");
defer p.deinit();
var line: [512]u8 = undefined;
- const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{"no-such-dir/" ** 20}));
+ const r = th.wr(p, Node.of(serialOf(p), .look), try std.fmt.bufPrint(&line, "./{s}x.txt\n", .{std.mem.asBytes(&@as([20][12]u8, @splat("no-such-dir/".*)))}));
try testing.expectEqual(Status.ok, r.reply.status);
try testing.expect(th.logHas(p, "x.txt: no such file"));
}
@@ -1492,17 +1492,17 @@ test "README names every file the tree serves" {
return false;
}
};
- inline for (@typeInfo(TopFile).@"enum".fields) |f| {
- const t: TopFile = @enumFromInt(f.value);
+ inline for (@typeInfo(TopFile).@"enum".field_values) |value| {
+ const t: TopFile = @enumFromInt(value);
if (t != .root and !words.has(t.fileName())) {
std.debug.print("README does not mention /{s}\n", .{t.fileName()});
return error.Undocumented;
}
}
- inline for (@typeInfo(PaneFile).@"enum".fields) |f| {
- const t: PaneFile = @enumFromInt(f.value);
+ inline for (@typeInfo(PaneFile).@"enum".field_values) |value| {
+ const t: PaneFile = @enumFromInt(value);
const ok = if (t == .dir) true else if (t.inPty() and t != .pty)
- std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(f.value)).fileName()) != null
+ std.mem.indexOf(u8, fs.help, "pty/" ++ comptime @as(PaneFile, @enumFromInt(value)).fileName()) != null
else
words.has(t.fileName());
if (!ok) {