authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-12 03:15:12-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-12 03:15:12-05:00
log227ead54be9331f87e5e3e92082dc405ef643e57
treeb0a345716f667000320e56cb61e28fd8adec8723
parent4a4ea92cf38372dc63184957e2936fa7989743fb

back to malloc instead of aligned_alloc for c_allocator

it seems that a 7 years old standard is still too new for the libc variants that are ubiquitous (tests failing on macos for not providing C11 ABI)

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

std/heap.zig+2-1
......@@ -17,7 +17,8 @@ var c_allocator_state = Allocator {
1717};
1818
1919fn cAlloc(self: &Allocator, n: usize, alignment: u29) ![]u8 {
20 return if (c.aligned_alloc(alignment, n)) |buf|
20 assert(alignment <= @alignOf(c_longdouble));
21 return if (c.malloc(n)) |buf|
2122 @ptrCast(&u8, buf)[0..n]
2223 else
2324 error.OutOfMemory;