zephyr::raw

Function k_realloc

source
pub unsafe extern "C" fn k_realloc(
    ptr: *mut c_void,
    size: 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 ptr Original pointer returned from a previous allocation @param size Amount of memory requested (in bytes).

@return Pointer to memory the caller can now use, or NULL.