Method

GLibBytesunref_to_data

Declaration

gpointer
g_bytes_unref_to_data (
  GBytes* bytes,
  gsize* size
)

Description

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(). In all other cases the data is copied.

Available since:2.32

Parameters

size gsize*
 

Location to place the length of the returned data.

 The argument will be set by the function.

Return value

Returns: 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.