Function
GLibArraynew_take_zero_terminated
since: 2.76
Declaration
GArray*
g_array_new_take_zero_terminated (
gpointer data,
gboolean clear,
gsize element_size
)
Description
Creates a new GArray
with data
as array data, computing the length of it
and setting the reference count to 1.
This avoids having to copy the data manually, when it can just be
inherited. data
will eventually be freed using g_free(), so must
have been allocated with a suitable allocator.
The length is calculated by iterating through data
until the first NULL
element is found.
In case the elements need to be cleared when the array is freed, use
g_array_set_clear_func()
to set a GDestroyNotify
function to perform
such task.
Do not use it if data
length or element_size
are greater than G_MAXUINT
.
GArray
stores the length of its data in #guint, which may be shorter
than #gsize.
Available since: 2.76
This function is not directly available to language bindings.