mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
update to new allocator interface
See https://github.com/ziglang/zig/pull/20511 . Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
This commit is contained in:
parent
f7fe61194b
commit
cf3a8f3043
1 changed files with 2 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ test "imports" {
|
||||||
// This allocator never returns an error, it either succeeds or causes ncdu to quit.
|
// 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,
|
// (Which means you'll find a lot of "catch unreachable" sprinkled through the code,
|
||||||
// they look scarier than they are)
|
// 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) {
|
while (true) {
|
||||||
if (std.heap.c_allocator.vtable.alloc(undefined, len, ptr_alignment, return_address)) |r|
|
if (std.heap.c_allocator.vtable.alloc(undefined, len, ptr_alignment, return_address)) |r|
|
||||||
return r
|
return r
|
||||||
|
|
@ -56,6 +56,7 @@ pub const allocator = std.mem.Allocator{
|
||||||
.alloc = wrapAlloc,
|
.alloc = wrapAlloc,
|
||||||
// AFAIK, all uses of resize() to grow an allocation will fall back to alloc() on failure.
|
// AFAIK, all uses of resize() to grow an allocation will fall back to alloc() on failure.
|
||||||
.resize = std.heap.c_allocator.vtable.resize,
|
.resize = std.heap.c_allocator.vtable.resize,
|
||||||
|
.remap = std.heap.c_allocator.vtable.remap,
|
||||||
.free = std.heap.c_allocator.vtable.free,
|
.free = std.heap.c_allocator.vtable.free,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue