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 tab_ptr pointer to the array to grow
@param nb_ptr pointer to the number of elements in the array
@param elem_size size in bytes of the elements in the array
@param elem_data pointer to the data of the element to add. If NULL, the space of
the new added element is not filled.
@return pointer to the data of the element to copy in the new allocated space.
If NULL, the new allocated space is left uninitialized."
@see av_dynarray_add(), av_dynarray_add_nofree()
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 tab_ptr pointer to the array to grow @param nb_ptr pointer to the number of elements in the array @param elem_size size in bytes of the elements in the array @param elem_data pointer to the data of the element to add. If NULL, the space of the new added element is not filled. @return pointer to the data of the element to copy in the new allocated space. If NULL, the new allocated space is left uninitialized." @see av_dynarray_add(), av_dynarray_add_nofree()