mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
Fix aligned reallocation from zero size.
This commit is contained in:
parent
8be6c98ca6
commit
c021a44567
@ -74,7 +74,7 @@ pub const Allocator = struct {
|
|||||||
|
|
||||||
pub fn alignedRealloc(self: *Allocator, comptime T: type, comptime alignment: u29, old_mem: []align(alignment) T, n: usize) ![]align(alignment) T {
|
pub fn alignedRealloc(self: *Allocator, comptime T: type, comptime alignment: u29, old_mem: []align(alignment) T, n: usize) ![]align(alignment) T {
|
||||||
if (old_mem.len == 0) {
|
if (old_mem.len == 0) {
|
||||||
return self.alloc(T, n);
|
return self.alignedAlloc(T, alignment, n);
|
||||||
}
|
}
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
self.free(old_mem);
|
self.free(old_mem);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user