Skip to main content

js_realloc2

Function js_realloc2 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn js_realloc2( _ctx: *mut JsContext, ptr: *mut c_void, size: usize, pslack: *mut usize, ) -> *mut c_void
Expand description

js_realloc2: js_realloc that also reports the slack.

The reference answers NULL without reallocating when growing would not be worth it; ours always reallocates and reports the difference. *pslack is only written when the pointer is non-null, which is what the callers in quickjs-libc.c rely on.

ยงSafety

Same as js_realloc; pslack must be null or writable.