The purpose of this list functions is providing efficient appending, prepending of items to a list structure, fast lookup of the list length, fast access to the list head and tail. Additionally, some basic checks prevent modification of the list whilst traversing it.
|
Data Structures |
| struct | list |
| struct | list_iter |
Defines |
| #define | equiv(p, q) (!(p) == !(q)) |
| #define | list_regression(list) |
Enumerations |
| enum | list_magic_t { LIST_MAGIC = 0x134747a9U
} |
| enum | list_iter_magic_t { LIST_ITER_MAGIC = 0x3fae3587U
} |
Functions |
| void | list_check (const list_t *list) |
| void | list_iter_check (const list_iter_t *iter) |
| list_t * | list_new (void) |
| | Create a new list.
|
| void | list_free (list_t **list_ptr) |
| | Dispose of the data structure.
|
| void | list_append (list_t *list, gpointer key) |
| | Append `key' to the list.
|
| void | list_prepend (list_t *list, gpointer key) |
| | Prepend `key' to the list.
|
| void | list_insert_sorted (list_t *list, gpointer key, GCompareFunc func) |
| | Insert `key' into the list.
|
| gboolean | list_remove (list_t *list, gpointer key) |
| | Remove `key' from the list.
|
| gpointer | list_tail (const list_t *list) |
| gpointer | list_head (const list_t *list) |
| gboolean | list_moveto_head (list_t *list, gpointer key) |
| | Move entry to the head of the list.
|
| gboolean | list_moveto_tail (list_t *list, gpointer key) |
| | Move entry to the tail of the list.
|
| guint | list_length (const list_t *list) |
| list_iter_t * | list_iter_before_head (list_t *list) |
| | Get an iterator on the list, positioned before first item.
|
| list_iter_t * | list_iter_after_tail (list_t *list) |
| | Get an iterator on the list, positioned after tail item.
|
| gpointer | list_iter_next (list_iter_t *iter) |
| | Moves the iterator to the next element and returns its key.
|
| gboolean | list_iter_has_next (const list_iter_t *iter) |
| | Checks whether there is a next item to be iterated over.
|
| gpointer | list_iter_previous (list_iter_t *iter) |
| | Moves the iterator to the previous element and returns its key.
|
| gpointer | list_iter_current (list_iter_t *iter) |
| gboolean | list_iter_has_previous (const list_iter_t *iter) |
| | Checks whether there is a previous item in the iterator.
|
| void | list_iter_free (list_iter_t **iter_ptr) |
| | Release the iterator once we're done with it.
|
| gboolean | list_contains (list_t *list, gconstpointer key, GEqualFunc func, gpointer *orig_key) |
| | Check whether list contains the `key' whereas equality is determined using `func'.
|
| void | list_foreach (const list_t *list, GFunc func, gpointer user_data) |
| | Apply `func' to all the items in the structure.
|