Trait method lrs::alloc::Allocator::reallocate_array

Reallocates an array.

Syntax

unsafe fn reallocate_array<T>(pool: &mut <Self as Allocator>::Pool, ptr: *mut T, oldnum: usize, newnum: usize) -> Result<*mut T, Errno>

Arguments

NameDescription
pool

The pool from which to draw memory.

ptr

The pointer that should be reallocated.

oldnum
newnum

The new number of elements in the array.

Return value

Returns a pointer to the new array.

Remarks

If T has size 0, a call to this function behaves like a call to empty_ptr. Otherwise:

The pointer argument must be a pointer returned by a previous call to allocate_array or reallocate_array with the same allocator and pool. The oldnum argument must be the number of elements pointed to by the pointer argument.

Otherwise the behavior is undefined.

If newnum is 0, the behavior is undefined.

If this function returns successfully, the old pointer becomes invalid and must no longer be used. Otherwise the old pointer can continued to be used.