authorgravatar for rganesan@gmail.comGanesan Rajagopal <rganesan@gmail.com> 2022-12-04 18:45:25+05:30
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-13 15:04:03-05:00
log21c2bca908375f3e718b0f9fb8ee2a9c68522690
tree129519d157a2ff2c68ea8fd9afe994898bab2a2d
parent6486ee9fc7bfbf8ac3ca1f76ff01c7dfeb6d73d4

Allocator.zig: minor fixes

* Remove recursive call using null alignment, since it's no longer relevant. * Fix comment

1 files changed, 2 insertions(+), 5 deletions(-)

lib/std/mem/Allocator.zig+2-5
......@@ -200,12 +200,9 @@ pub fn allocAdvancedWithRetAddr(
200200 n: usize,
201201 return_address: usize,
202202) Error![]align(alignment orelse @alignOf(T)) T {
203 const a = if (alignment) |a| blk: {
204 if (a == @alignOf(T)) return allocAdvancedWithRetAddr(self, T, null, n, return_address);
205 break :blk a;
206 } else @alignOf(T);
203 const a = alignment orelse @alignOf(T);
207204
208 // The Zig Allocator interface is not intended to solve allocations beyond
205 // The Zig Allocator interface is not intended to solve alignments beyond
209206 // the minimum OS page size. For these use cases, the caller must use OS
210207 // APIs directly.
211208 comptime assert(a <= mem.page_size);