Function

GLibTreenew_full

Declaration

GTree*
g_tree_new_full (
  GCompareDataFunc key_compare_func,
  gpointer key_compare_data,
  GDestroyNotify key_destroy_func,
  GDestroyNotify value_destroy_func
)

Description

Creates a new GTree like g_tree_new() and allows to specify functions to free the memory allocated for the key and value that get called when removing the entry from the GTree.

Parameters

key_compare_func

Type: GCompareDataFunc

Qsort()-style comparison function.

key_compare_data

Type: gpointer

Data to pass to comparison function.

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

Type: GDestroyNotify

A function to free the memory allocated for the key used when removing the entry from the GTree or NULL if you don’t want to supply such a function.

value_destroy_func

Type: GDestroyNotify

A function to free the memory allocated for the value used when removing the entry from the GTree or NULL if you don’t want to supply such a function.

Return value

Type: GTree

A newly allocated GTree.

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