Skip to content

Commit 317ed57

Browse files
committedJul 14, 2018
docs: clarify mem.Allocator.reallocFn
·
0.15.10.3.0
1 parent 5f1aa35 commit 317ed57

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎std/mem.zig‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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,

0 commit comments

Comments
 (0)
Please sign in to comment.