From cf3a8f30431f507c260a483ac45a6c98ed4b3d06 Mon Sep 17 00:00:00 2001 From: Eric Joldasov Date: Sun, 9 Feb 2025 13:23:34 +0500 Subject: [PATCH] update to new allocator interface See https://github.com/ziglang/zig/pull/20511 . Signed-off-by: Eric Joldasov --- src/main.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index 061db90..d09ce60 100644 --- a/src/main.zig +++ b/src/main.zig @@ -41,7 +41,7 @@ test "imports" { // This allocator never returns an error, it either succeeds or causes ncdu to quit. // (Which means you'll find a lot of "catch unreachable" sprinkled through the code, // they look scarier than they are) -fn wrapAlloc(_: *anyopaque, len: usize, ptr_alignment: u8, return_address: usize) ?[*]u8 { +fn wrapAlloc(_: *anyopaque, len: usize, ptr_alignment: std.mem.Alignment, return_address: usize) ?[*]u8 { while (true) { if (std.heap.c_allocator.vtable.alloc(undefined, len, ptr_alignment, return_address)) |r| return r @@ -56,6 +56,7 @@ pub const allocator = std.mem.Allocator{ .alloc = wrapAlloc, // AFAIK, all uses of resize() to grow an allocation will fall back to alloc() on failure. .resize = std.heap.c_allocator.vtable.resize, + .remap = std.heap.c_allocator.vtable.remap, .free = std.heap.c_allocator.vtable.free, }, };