G-Golf Glib Singly-Linked Lists low level API.
Singly-Linked Lists — Linked lists that can be iterated over in one
direction
The GSList
structure and its associated functions provide a
standard singly-linked list data structure.
Each element in the list contains a piece of data, together with a pointer which links to the next element in the list. Using this pointer it is possible to move through the list in one direction only (unlike the Doubly-Linked Lists, which allow movement in both directions).
Please read the Singly-Linked-Lists section from the Glib reference manual for a complete description.
Returns a pointer.
Obtains and returns a pointer to the data in g-slist, or any integer value, in which case, it is the responsibility of the caller to apply the appropriate type conversion procedure.
Returns a pointer or #f.
Obtains and returns the next element in g-slist, or #f if there are no more elements.
Returns a pointer.
Adds data - which is (must be) a pointer - to the end of g-slist and returns a pointer to the (possibly new) start of the list (so make sure you store the new value).
Note that g-slist-append has to traverse the entire list to find the end, which is inefficient when adding multiple elements. A common idiom to avoid the inefficiency is to prepend the elements and reverse the list when all elements have been added.
Returns a pointer.
Adds data - which is (must be) a pointer - to the start of g-slist and returns a pointer to the (possibly new) start of the list (so make sure you store the new value).
Returns nothing.
Frees all of the memory used by g-slist.
Returns an integer.
Obtains and returns the number of elements in g-slist. This function iterates over the whole list to count its elements.
Returns a pointer or #f.
Obtains and returns a pointer to the data of the n-th element of g-slist. This iterates over the list until it reaches the n-th position. If n is off the end of g-slist, it returns #f.