Function
GLibPtrArraynew_null_terminated
since: 2.74
Declaration
GPtrArray*
g_ptr_array_new_null_terminated (
guint reserved_size,
GDestroyNotify element_free_func,
gboolean null_terminated
)
Description
Like g_ptr_array_new_full() but also allows to set the array to
be NULL terminated. A NULL terminated pointer array has an
additional NULL pointer after the last element, beyond the
current length.
GPtrArray created by other constructors are not automatically NULL
terminated.
Note that if the array‘s length is zero and currently no
data array is allocated, then pdata will still be NULL.
%GPtrArray will only NULL terminate pdata, if an actual
array is allocated. It does not guarantee that an array
is always allocated. In other words, if the length is zero,
then pdata may either point to a NULL terminated array of length
zero or be NULL.
Available since: 2.74
This function is not directly available to language bindings.
Parameters
reserved_size-
Type:
guintNumber of pointers preallocated. If
null_terminatedisTRUE, the actually allocated buffer size isreserved_sizeplus 1, unlessreserved_sizeis zero, in which case no initial buffer gets allocated. element_free_func-
Type:
GDestroyNotifyA function to free elements with destroy
arrayorNULL. null_terminated-
Type:
gbooleanWhether to make the array as
NULLterminated.