Function

GLibListfind_custom

Declaration

GList*
g_list_find_custom (
  GList* list,
  gconstpointer data,
  GCompareFunc func
)

Description

Finds an element in a GList, using a supplied function to find the desired element. It iterates over the list, calling the given function which should return 0 when the desired element is found. The function takes two #gconstpointer arguments, the GList element’s data as the first argument and the given user data.

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.
data

Type: gconstpointer

User data passed to the function.

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

Type: GCompareFunc

The function to call for each element. It should return 0 when the desired element is found.

Return value

Type: A list of gpointer

The found GList element, or NULL if it is not found.

The data is owned by the called function.