This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
struct | _slist |
The actual list. More... | |
struct | _slist_e |
Implementation of an element in the linked list. More... | |
struct | slist_iter |
List iterator. More... | |
Typedefs | |
typedef _slist_e | slist_e |
Implementation of an element in the linked list. | |
typedef _slist | slist |
The actual list. | |
Functions | |
void | slist_init (slist *s) |
Initialise a list. | |
void | slist_delete (slist *s) |
Free all memory used by the list s. | |
void | slist_delete_special (slist *s, void(*func)(void *)) |
Free all memory used by the list in a custom way. | |
void | slist_delete_list_only (slist *s) |
Free all memory used by the elements in list s. | |
void * | slist_first (const slist *s) |
Return the first data element from s. | |
void * | slist_last (const slist *s) |
Return the last data element from the list. | |
void * | slist_at_iter (slist_iter iter) |
Retrieve the data element at the iterator from the list. | |
void | slist_prepend (slist *s, void *data) |
Insert a new data element at the start of the list. | |
void | slist_append (slist *s, void *data) |
Insert a new data element at the end of the list. | |
void | slist_insert (slist *s, slist_iter *iter, void *data) |
Insert a new data element right before the iterator. | |
void * | slist_remove_first (slist *s) |
Remove the first data element from the list. | |
void * | slist_remove_last (slist *s) |
Remove the last data element from the list. | |
void * | slist_remove_at_iter (slist *s, slist_iter iter) |
Remove the data element at the iterator. | |
slist_iter | slist_begin_iter (const slist *s) |
Create an iterator that points at the first data element of the list. | |
slist_iter | slist_end_iter (const slist *s) |
Create an iterator that points right behind the last element of the list. | |
void * | slist_iter_and_next (slist_iter *iter) |
Retrieve the data element at the iterator's position, and move to the next element in the list. | |
void | slist_for_each (const slist *s, void(*func)(void *data, void *userdata), void *userdata) |
Call func() for every element in the list. | |
void | slist_for_each_range (slist_iter start, slist_iter end, void(*func)(void *data, void *userdata), void *userdata) |
Call func() for every element between the iterators start and end, including start and excluding end. | |
int | slist_iter_eq (slist_iter a, slist_iter b) |
Test two iterators for equality. | |
int | slist_iter_at_end (slist_iter iter) |
Test if an iterator is at the end of a list. | |
slist_iter | slist_find (const slist *s, const void *data) |
Search for a data item in the list. | |
slist_iter | slist_find_if (const slist *s, const void *compare, int(*func)(const void *data, const void *compare)) |
Search for a data item in the list with a user-defined function for comparing two elements. | |
unsigned int | slist_length (const slist *s) |
Determine the length of the list. |
This list only takes data elements of type void*. You will have to cast the elements back to the right type after retrieving them. It is allowed to insert NULL elements.
Definition in file slist.h.
|
Insert a new data element at the end of the list.
|
|
Retrieve the data element at the iterator from the list.
|
|
Create an iterator that points at the first data element of the list.
|
|
Free all memory used by the list s. Calls free() for every slist_elem struct in the list, and for every data element.
|
|
Free all memory used by the elements in list s. Calls free() for every slist_elem struct in s, leaving the data elements alone.
|
|
Free all memory used by the list in a custom way. Calls free() for every slist_elem struct in s, and the user-defined func() for every data element.
|
|
Create an iterator that points right behind the last element of the list. (It does not point at an actual data element.)
|
|
Search for a data item in the list. If the item could not be found, and end of list iterator is returned. Use slist_iter_at_end or slist_iter_eq to test for this condition.
|
|
Search for a data item in the list with a user-defined function for comparing two elements. If the item could not be found, and end of list iterator is returned. Use slist_iter_at_end or slist_iter_eq to test for this condition.
|
|
Return the first data element from s.
|
|
Call func() for every element in the list. The variable userdata can be used to pass extra information to the function func.
|
|
Call func() for every element between the iterators start and end, including start and excluding end. The variable userdata can be used to pass extra information to the function func.
|
|
Initialise a list. The elements of the slist struct s are set to NULL.
|
|
Insert a new data element right before the iterator.
|
|
Retrieve the data element at the iterator's position, and move to the next element in the list. If the iterator was not valid, NULL is returned and /a iter remains unchanged.
|
|
Test if an iterator is at the end of a list.
|
|
Test two iterators for equality.
|
|
Return the last data element from the list.
|
|
Determine the length of the list.
|
|
Insert a new data element at the start of the list.
|
|
Remove the data element at the iterator. The iterator is no longer valid after this call.
|
|
Remove the first data element from the list.
|
|
Remove the last data element from the list.
|