zephyr::raw

Function sys_heap_aligned_realloc

source
pub unsafe extern "C" fn sys_heap_aligned_realloc(
    heap: *mut sys_heap,
    ptr: *mut c_void,
    align: usize,
    bytes: usize,
) -> *mut c_void
Expand description

@brief Expand the size of an existing allocation

Returns a pointer to a new memory region with the same contents, but a different allocated size. If the new allocation can be expanded in place, the pointer returned will be identical. Otherwise the data will be copies to a new block and the old one will be freed as per sys_heap_free(). If the specified size is smaller than the original, the block will be truncated in place and the remaining memory returned to the heap. If the allocation of a new block fails, then NULL will be returned and the old block will not be freed or modified.

@param heap Heap from which to allocate @param ptr Original pointer returned from a previous allocation @param align Alignment in bytes, must be a power of two @param bytes Number of bytes requested for the new block @return Pointer to memory the caller can now use, or NULL