Skip to main content

cove_alloc

Function cove_alloc 

Source
#[unsafe(no_mangle)]
pub extern "C" fn cove_alloc(len: usize) -> *mut u8
Expand description

Reserves len bytes of the module’s memory and answers where they start.

Byte-aligned, because everything that crosses this boundary is UTF-8 or a little-endian integer read a byte at a time by a DataView.

A zero-length request answers a non-null aligned offset that must still be passed back to cove_free, so a caller never has to special-case the empty string.

§Safety

The caller owns the returned block until it hands it to cove_free. Nothing else in this module will free it.