aboutsummaryrefslogtreecommitdiff
path: root/std/heap.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-06-04 22:11:14 -0400
committerGitHub <noreply@github.com>2018-06-04 22:11:14 -0400
commite53b683bd3958a7b1c517e2391edce42b9d4e48b (patch)
treec9b8aacf92b2140c1cc076e2de280e10657d0a98 /std/heap.zig
parent32e0dfd4f0dab351a024e7680280343db5d7c43e (diff)
downloadzig-e53b683bd3958a7b1c517e2391edce42b9d4e48b.tar.gz
zig-e53b683bd3958a7b1c517e2391edce42b9d4e48b.zip
Pointer Reform: proper slicing and indexing (#1053)
* enable slicing for single-item ptr to arrays * disable slicing for other single-item pointers * enable indexing for single-item ptr to arrays * disable indexing for other single-item pointers see #770 closes #386
Diffstat (limited to 'std/heap.zig')
-rw-r--r--std/heap.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/std/heap.zig b/std/heap.zig
index 0b8f4aeb3f..4444a2307a 100644
--- a/std/heap.zig
+++ b/std/heap.zig
@@ -24,7 +24,7 @@ fn cAlloc(self: *Allocator, n: usize, alignment: u29) ![]u8 {
fn cRealloc(self: *Allocator, old_mem: []u8, new_size: usize, alignment: u29) ![]u8 {
const old_ptr = @ptrCast([*]c_void, old_mem.ptr);
if (c.realloc(old_ptr, new_size)) |buf| {
- return @ptrCast(*u8, buf)[0..new_size];
+ return @ptrCast([*]u8, buf)[0..new_size];
} else if (new_size <= old_mem.len) {
return old_mem[0..new_size];
} else {