Function

GLibBytesnew_with_free_func

since: 2.32

Declaration [src]

GBytes*
g_bytes_new_with_free_func (
  gconstpointer data,
  gsize size,
  GDestroyNotify free_func,
  gpointer user_data
)

Description [src]

Creates a GBytes from data.

When the last reference is dropped, free_func will be called with the user_data argument.

data must not be modified after this call is made until free_func has been called to indicate that the bytes is no longer in use.

data may be NULL if size is 0.

Available since: 2.32

This function is not directly available to language bindings.

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.

free_func

Type: GDestroyNotify

The function to call to release the data.

user_data

Type: gpointer

Data to pass to free_func.

The argument can be NULL.
The data is owned by the caller of the function.

Return value

Type: GBytes

A new GBytes.

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