ArrayG.steal

Frees the data in the array and resets the size to zero, while the underlying array is preserved for use elsewhere and returned to the caller.

If the array was created with the @zero_terminate property set to %TRUE, the returned data is zero terminated too.

If array elements contain dynamically-allocated memory, the array elements should also be freed by the caller.

A short example of use: |[<!-- language="C" --> ... gpointer data; gsize data_len; data = g_array_steal (some_array, &data_len); ... ]|

class ArrayG
void*
steal
(
out size_t len
)

Parameters

len size_t

pointer to retrieve the number of elements of the original array

Return Value

Type: void*

the element data, which should be freed using g_free().

Meta

Since

2.64