aboutsummaryrefslogtreecommitdiff
path: root/std/heap.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-02-12 03:15:12 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-02-12 03:15:12 -0500
commit227ead54be9331f87e5e3e92082dc405ef643e57 (patch)
treeb0a345716f667000320e56cb61e28fd8adec8723 /std/heap.zig
parent4a4ea92cf38372dc63184957e2936fa7989743fb (diff)
downloadzig-227ead54be9331f87e5e3e92082dc405ef643e57.tar.gz
zig-227ead54be9331f87e5e3e92082dc405ef643e57.zip
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 (limited to 'std/heap.zig')
-rw-r--r--std/heap.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/std/heap.zig b/std/heap.zig
index 9156dfe936..f309a08a8a 100644
--- 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;