### Method

# GLib Bytes unref_to_data

since: 2.32

#### Declaration [src]

    gpointer
    g_bytes_unref_to_data (
      GBytes* bytes,
      gsize* size
    )

#### Description [src]

Unreferences the bytes, and returns a pointer the same byte data contents.

As an optimization, the byte data is returned without copying if this was the last reference to `bytes` and `bytes` was created with `g_bytes_new()`, `g_bytes_new_take()` or `g_byte_array_free_to_bytes()` and the buffer was larger than the size `GBytes` may internalize within its allocation. In all other cases the data is copied.

Available since: 2.32

#### Parameters

`bytes`

  Type: `GBytes`

  A `GBytes`.

  The instance takes ownership of the data, and is responsible for freeing it.

`size`

  Type: `gsize*`

  Location to place the length of the returned data.

  The argument will be set by the function.

#### Return value

Type: An array of `guint8`

a pointer to the same byte data, which should be freed with `g_free()`.

The length of the array is in the `size` argument.