Array.take_zero_terminated
Description:
public Array.take_zero_terminated (owned G[] data, bool clear = true, size_t element_size = sizeof ( G))
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. After this call, data belongs to the `GArray` and may
no longer be modified by the caller. The memory of data has to be dynamically allocated and will eventually be freed with [
func@GLib.free].
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 [func@GLib.Array.set_clear_func] to set a [callback@GLib.DestroyNotify] function to perform such task.
Do not use it if data length or element_size are greater than [`G_MAXUINT`](types.html#guint). `GArray` stores the
length of its data in `guint`, which may be shorter than `gsize`.
Parameters:
| data |
an array of elements of |
| clear |
if true, `GArray` elements should be automatically cleared to 0 when they are allocated |
| element_size |
the size of each element in bytes |
Returns:
|
The new `GArray` |