Function

GLibBytesnew_take

since: 2.32

Declaration

GBytes*
g_bytes_new_take (
  gpointer data,
  gsize size
)

Description

Creates a new GBytes from data.

After this call, data belongs to the GBytes and may no longer be modified by the caller. The memory of data has to be dynamically allocated and will eventually be freed with g_free().

For creating GBytes with memory from other allocators, see g_bytes_new_with_free_func().

data may be NULL if size is 0.

Available since: 2.32

Parameters

data

Type: An array of guint8

   the data to be used for the bytes.

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

Type: gsize

The size of data.

Return value

Type: GBytes

A new GBytes.

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