Function

GLibSListprepend

Declaration [src]

GSList*
g_slist_prepend (
  GSList* list,
  gpointer data
)

Description [src]

Adds a new element on to the start of the list.

The return value is the new start of the list, which may have changed, so make sure you store the new value.

// Notice that it is initialized to the empty list.
GSList *list = NULL;
list = g_slist_prepend (list, "last");
list = g_slist_prepend (list, "first");

This function is not directly available to language bindings.

Parameters

list

Type: A list of gpointer

A GSList.

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

Type: gpointer

The data for the new element.

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

Return value

Type: A list of gpointer

The new start of the GSList.

The data is owned by the called function.