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 {...@@ -23,7 +23,10 @@ pub const Allocator = struct {
23 /// * this function must return successfully.23 /// * this function must return successfully.
24 /// * alignment <= alignment of old_mem.ptr24 /// * alignment <= alignment of old_mem.ptr
25 ///25 ///
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.
27 /// `alignment` is guaranteed to be >= 130 /// `alignment` is guaranteed to be >= 1
28 /// `alignment` is guaranteed to be a power of 231 /// `alignment` is guaranteed to be a power of 2
29 reallocFn: fn (self: *Allocator, old_mem: []u8, new_byte_count: usize, alignment: u29) Error![]u8,32 reallocFn: fn (self: *Allocator, old_mem: []u8, new_byte_count: usize, alignment: u29) Error![]u8,