GLib.Array.steal
Description: Reference for GLib.Array.steal

### Function

# GLib Arraysteal

since: 2.64

#### Declaration [src]

    gpointer
    g_array_steal (
      GArray* array,
      gsize* len
    )

#### Description [src]

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.

Note that if the array was created with the `zero_terminate` property set to `TRUE`, this may still return `NULL` if the length of the array was zero and data was not yet allocated.

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

A short example of use:

    ...
    gpointer data;
    gsize data_len;
    data = g_array_steal (some_array, &data_len);
    ...

Available since: 2.64

This function is not directly available to language bindings.

#### Parameters

`array`

  Type: An array of `gpointer`

  A `GArray`.

  The data is owned by the caller of the function.

`len`

  Type: `gsize*`

  Pointer to retrieve the number of elements of the original array.

  The argument will be set by the function.
  The argument can be `NULL`.

#### Return value

Type: `gpointer`

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

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.