authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-07-13 21:43:11-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-07-14 09:55:10-04:00
log317ed57cb1e238664a123b940f4a50697653a9bb
tree839c2875b057d02fcda17ad6ec924eae9d8d2193
parent5f1aa3505d387bcc164cb102be11fd5cb054f4ef

docs: clarify mem.Allocator.reallocFn


1 files changed, 4 insertions(+), 1 deletions(-)

std/mem.zig+4-1
......@@ -23,7 +23,10 @@ pub const Allocator = struct {
2323 /// * this function must return successfully.
2424 /// * alignment <= alignment of old_mem.ptr
2525 ///
26 /// The returned newly allocated memory is undefined.
26 /// When `reallocFn` returns,
27 /// `return_value[0..min(old_mem.len, new_byte_count)]` must be the same
28 /// as `old_mem` was when `reallocFn` is called. The bytes of
29 /// `return_value[old_mem.len..]` have undefined values.
2730 /// `alignment` is guaranteed to be >= 1
2831 /// `alignment` is guaranteed to be a power of 2
2932 reallocFn: fn (self: *Allocator, old_mem: []u8, new_byte_count: usize, alignment: u29) Error![]u8,