Function

GLibListremove_link

Declaration

GList*
g_list_remove_link (
  GList* list,
  GList* llink
)

Description

Removes an element from a GList, without freeing the element. The removed element’s prev and next links are set to NULL, so that it becomes a self-contained list with one element.

This function is for example used to move an element in the list (see the example for g_list_concat()) or to remove an element in the list before freeing its data:

list = g_list_remove_link (list, llink);
free_some_data_that_may_access_the_list_again (llink->data);
g_list_free (llink);

Parameters

list

Type: A list of gpointer

A GList, this must point to the top of the list.

The data is owned by the caller of the function.
llink

Type: A list of gpointer

An element in the GList.

The data is owned by the caller of the function.

Return value

Type: A list of gpointer

The (possibly changed) start of the GList.

The data is owned by the called function.