Function

GLibListsort

Declaration

GList*
g_list_sort (
  GList* list,
  GCompareFunc compare_func
)

Description

Sorts a GList using the given comparison function. The algorithm used is a stable sort.

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

Type: GCompareFunc

The comparison function used to sort the GList. This function is passed the data from 2 elements of the GList and should return 0 if they are equal, a negative value if the first element comes before the second, or a positive value if the first element comes after the second.

Return value

Type: A list of gpointer

The (possibly changed) start of the GList.

The data is owned by the called function.