zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d68ae35c1153c6263292d60e4f5f6b828d7c8e8f (tree)
parent da7880b4cf1b909c68aed2d1f6c702cca0807ee8
Author: daurnimator <quae@daurnimator.com>
Date:   Wed, 20 Feb 2019 13:28:56 +1100

std: when a FixedBufferAllocator is initialised, set the buffer to undefined

Diffstat:
Mstd/heap.zig | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/std/heap.zig b/std/heap.zig @@ -273,6 +273,10 @@ pub const FixedBufferAllocator = struct { buffer: []u8, pub fn init(buffer: []u8) FixedBufferAllocator { + // This loop gets optimized out in ReleaseFast mode + for (buffer) |*byte| { + byte.* = undefined; + } return FixedBufferAllocator{ .allocator = Allocator{ .allocFn = alloc,