diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-03-15 18:57:07 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-03-15 18:57:07 -0400 |
| commit | 01fb42103115a58c4b693a600dc5379fedb4ea86 (patch) | |
| tree | a3eea8feeabdb3baba23bec9d71217d91a623f2b /std | |
| parent | 9c13e9b7ed9806d0f9774433d5e24359aff1b238 (diff) | |
| download | zig-01fb42103115a58c4b693a600dc5379fedb4ea86.tar.gz zig-01fb42103115a58c4b693a600dc5379fedb4ea86.zip | |
fix regressions on Windows from previous commit
Diffstat (limited to 'std')
| -rw-r--r-- | std/heap.zig | 3 | ||||
| -rw-r--r-- | std/os/windows/util.zig | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/std/heap.zig b/std/heap.zig index 84ed469763..dd5cfa4cd7 100644 --- a/std/heap.zig +++ b/std/heap.zig @@ -143,8 +143,9 @@ pub const DirectAllocator = struct { return result; }, Os.windows => { - const self = @fieldParentPtr(DirectAllocator, "allocator", allocator); + if (old_mem.len == 0) return alloc(allocator, new_size, new_align); + const self = @fieldParentPtr(DirectAllocator, "allocator", allocator); const old_adjusted_addr = @ptrToInt(old_mem.ptr); const old_record_addr = old_adjusted_addr + old_mem.len; const root_addr = @intToPtr(*align(1) usize, old_record_addr).*; diff --git a/std/os/windows/util.zig b/std/os/windows/util.zig index 24039967a1..72c84502e3 100644 --- a/std/os/windows/util.zig +++ b/std/os/windows/util.zig @@ -197,7 +197,7 @@ pub fn createWindowsEnvBlock(allocator: *mem.Allocator, env_map: *const BufMap) i += 1; result[i] = 0; i += 1; - return allocator.shrink(u16, result, i); + return allocator.shrink(result, i); } pub fn windowsFindFirstFile( |
