[−][src]Function caldera_bindings::avutil::av_dynarray2_add
pub unsafe extern "C" fn av_dynarray2_add(
tab_ptr: *mut *mut c_void,
nb_ptr: *mut c_int,
elem_size: usize,
elem_data: *const u8
) -> *mut c_void
Add an element of size elem_size
to a dynamic array.
The array is reallocated when its number of elements reaches powers of 2. Therefore, the amortized cost of adding an element is constant.
In case of success, the pointer to the array is updated in order to
point to the new grown array, and the number pointed to by nb_ptr
is incremented.
In case of failure, the array is freed, *tab_ptr
is set to NULL
and
*nb_ptr
is set to 0.
@param[in,out] tab_ptr Pointer to the array to grow
@param[in,out] nb_ptr Pointer to the number of elements in the array
@param[in] elem_size Size in bytes of an element in the array
@param[in] elem_data Pointer to the data of the element to add. If
NULL
, the space of the newly added element is
allocated but left uninitialized.
@return Pointer to the data of the element to copy in the newly allocated space @see av_dynarray_add(), av_dynarray_add_nofree()