diff options
Diffstat (limited to 'std')
| -rw-r--r-- | std/mem.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/std/mem.zig b/std/mem.zig index 86c7a5a445..c7ebeb0157 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -94,6 +94,10 @@ pub const IncrementingAllocator = struct { _ = os.posix.munmap(self.bytes.ptr, self.bytes.len); } + fn reset(self: &IncrementingAllocator) { + self.end_index = 0; + } + fn alloc(allocator: &Allocator, n: usize, alignment: usize) -> %[]u8 { const self = @fieldParentPtr(IncrementingAllocator, "allocator", allocator); const addr = @ptrToInt(&self.bytes[self.end_index]); |
