Function

GLibBytesnew_with_free_func

Declaration

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

Description

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

Parameters

data An array of guint8
 
   the data to be used for the bytes.
 The length of the array is specified in the size argument.
size gsize
 

The size of data.

free_func GDestroyNotify
 

The function to call to release the data.

user_data gpointer
 

Data to pass to free_func.

Return value

Returns: GBytes
 

A new GBytes.

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