Function

GLibByteArrayfree_to_bytes

Declaration

GBytes*
g_byte_array_free_to_bytes (
  GByteArray* array
)

Description

Transfers the data from the GByteArray into a new immutable GBytes.

The GByteArray is freed unless the reference count of array is greater than one, the GByteArray wrapper is preserved but the size of array will be set to zero.

This is identical to using g_bytes_new_take() and g_byte_array_free() together.

Available since:2.32

Parameters

array An array of guint8
 

A GByteArray.

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

Return value

Returns: GBytes
 

A new immutable GBytes representing same byte data that was in the array.

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