commit 227ead54be9331f87e5e3e92082dc405ef643e57 (tree)
parent 4a4ea92cf38372dc63184957e2936fa7989743fb
Author: Andrew Kelley <superjoe30@gmail.com>
Date: Mon, 12 Feb 2018 03:15:12 -0500
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)
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/std/heap.zig b/std/heap.zig
@@ -17,7 +17,8 @@ var c_allocator_state = Allocator {
};
fn cAlloc(self: &Allocator, n: usize, alignment: u29) ![]u8 {
- return if (c.aligned_alloc(alignment, n)) |buf|
+ assert(alignment <= @alignOf(c_longdouble));
+ return if (c.malloc(n)) |buf|
@ptrCast(&u8, buf)[0..n]
else
error.OutOfMemory;