pub unsafe extern "C" fn CAlloc(
nitems: usize,
size: usize,
) -> *mut c_voidExpand description
Allocates zero-initialized memory for an array of elements.
This function has the same behavior as calloc, except that it does
not return on allocation failure. If memory cannot be allocated, an
error message is written to standard error and the process terminates.
Parameters:
nitems: Number of elements to allocate.size: Size in bytes of each element.
Returns:
- A pointer to zero-initialized memory on success.
NULLifsizeis zero.
Ownership:
The caller owns the returned memory and must release it using free.
Safety notes for FFI:
- This function never returns on out-of-memory conditions.
- It does not set
errno. - Callers must not assume recoverable failure semantics.