diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-08-25 20:05:19 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-08-25 20:05:19 +0200 |
commit | 74c8e2baf22c62b8015daf1b86e58fa4bf738bb4 (patch) | |
tree | 3257f5ea40641e07515e1d2b56105b7728a3b274 /src/cmd/sort.zig | |
parent | 41a94a7f354a72af807e25607de65ee98f3d1b63 (diff) |
Update to Zig 0.15.1.
Diffstat (limited to 'src/cmd/sort.zig')
-rw-r--r-- | src/cmd/sort.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/sort.zig b/src/cmd/sort.zig index 79616e9..5f75734 100644 --- a/src/cmd/sort.zig +++ b/src/cmd/sort.zig @@ -10,12 +10,12 @@ pub const Sort = struct { pub fn eval(sort: Sort, ctx: CommandContext) !CommandStatus { _ = sort; - var lines = ArrayList([]const u8).init(ctx.allocator); + var lines = ArrayList([]const u8){}; defer { for (lines.items) |line| { ctx.allocator.free(line); } - lines.deinit(); + lines.deinit(ctx.allocator); } // Read input lines from unified input reader @@ -33,7 +33,7 @@ pub const Sort = struct { .source => { // Read from input redirection while (try reader.readLine(ctx.allocator)) |line| { - try lines.append(line); + try lines.append(ctx.allocator, line); } }, } @@ -46,11 +46,11 @@ pub const Sort = struct { }.lessThan); // Output sorted lines - var output_buffer = ArrayList(u8).init(ctx.allocator); - defer output_buffer.deinit(); + var output_buffer = ArrayList(u8){}; + defer output_buffer.deinit(ctx.allocator); for (lines.items) |line| { - try output_buffer.writer().print("{s}\n", .{line}); + try output_buffer.writer(ctx.allocator).print("{s}\n", .{line}); } var writer = ctx.output_writer; |