diff options
| author | Lee Cannon <leecannon@leecannon.xyz> | 2021-10-29 00:37:25 +0100 |
|---|---|---|
| committer | Lee Cannon <leecannon@leecannon.xyz> | 2021-11-30 23:32:47 +0000 |
| commit | 85de022c5671d777f62ddff254a814dab05242fc (patch) | |
| tree | 037f58c4b07d18b80cf48cf74d0f0e8c8866f8f2 /src/tracy.zig | |
| parent | 1e0addcf73ee71d23a41b744995848bcca38e8d3 (diff) | |
| download | zig-85de022c5671d777f62ddff254a814dab05242fc.tar.gz zig-85de022c5671d777f62ddff254a814dab05242fc.zip | |
allocgate: std Allocator interface refactor
Diffstat (limited to 'src/tracy.zig')
| -rw-r--r-- | src/tracy.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tracy.zig b/src/tracy.zig index 3ef2df7ca0..8abd78110f 100644 --- a/src/tracy.zig +++ b/src/tracy.zig @@ -103,18 +103,18 @@ pub inline fn traceNamed(comptime src: std.builtin.SourceLocation, comptime name } } -pub fn tracyAllocator(allocator: *std.mem.Allocator) TracyAllocator(null) { +pub fn tracyAllocator(allocator: std.mem.Allocator) TracyAllocator(null) { return TracyAllocator(null).init(allocator); } pub fn TracyAllocator(comptime name: ?[:0]const u8) type { return struct { allocator: std.mem.Allocator, - parent_allocator: *std.mem.Allocator, + parent_allocator: std.mem.Allocator, const Self = @This(); - pub fn init(allocator: *std.mem.Allocator) Self { + pub fn init(allocator: std.mem.Allocator) Self { return .{ .parent_allocator = allocator, .allocator = .{ @@ -124,7 +124,7 @@ pub fn TracyAllocator(comptime name: ?[:0]const u8) type { }; } - fn allocFn(allocator: *std.mem.Allocator, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize) std.mem.Allocator.Error![]u8 { + fn allocFn(allocator: std.mem.Allocator, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize) std.mem.Allocator.Error![]u8 { const self = @fieldParentPtr(Self, "allocator", allocator); const result = self.parent_allocator.allocFn(self.parent_allocator, len, ptr_align, len_align, ret_addr); if (result) |data| { @@ -141,7 +141,7 @@ pub fn TracyAllocator(comptime name: ?[:0]const u8) type { return result; } - fn resizeFn(allocator: *std.mem.Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, ret_addr: usize) std.mem.Allocator.Error!usize { + fn resizeFn(allocator: std.mem.Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, ret_addr: usize) std.mem.Allocator.Error!usize { const self = @fieldParentPtr(Self, "allocator", allocator); if (self.parent_allocator.resizeFn(self.parent_allocator, buf, buf_align, new_len, len_align, ret_addr)) |resized_len| { |
