Skip to main content

xila_heap_reallocate

Function xila_heap_reallocate 

Source
pub unsafe extern "C" fn xila_heap_reallocate(
    heap: *mut Heap,
    pointer: *mut c_void,
    size: usize,
    allocation: *mut *mut c_void,
) -> Status
Expand description

Resize a block, preserving its contents up to the smaller of the old and new sizes. Failure leaves the old allocation and output unchanged. Size zero frees the block and stores null. A null pointer with nonzero size allocates a new block. A pointer that this heap does not own, an interior pointer or a freed block returns InvalidArgument, with the same trusted native contract as xila_heap_free.

ยงSafety

Heap must be live and exclusively accessed. Output must be aligned, writable and disjoint from the heap and its allocations.