Go to the source code of this file.
Defines | |
#define | LL_H 1 |
Typedefs | |
typedef elem_s | elem_t |
Linked list element. | |
typedef list_s | list_t |
Linked list. | |
typedef void | elem_destroy_cb (void *data) |
Callback prototype for destroying element data. | |
Functions | |
list_t * | list_new (elem_destroy_cb *cb) |
Creates a new linked list. | |
void | list_destroy (list_t *list) |
Free all resources associated with the given linked list. | |
void | list_flush (list_t *list) |
Remove all elements from the list without destroying the list itself. | |
void * | element_data (elem_t *elem) |
Retrieves the data associated with a list element. | |
elem_t * | list_append (list_t *list, void *data) |
Append a new element to the end of the list. | |
int | list_size (list_t *list) |
Returns the number of elements in the list. | |
elem_t * | list_get (list_t *list, int idx) |
Returns the list element at the specified index or NULL if the index is invalid. | |
elem_t * | list_first (list_t *list) |
Returns the first list element. | |
elem_t * | list_next (list_t *list) |
Returns the next list element. |
|
|
|
Callback prototype for destroying element data.
|
|
Linked list element.
|
|
Linked list.
|
|
Retrieves the data associated with a list element.
|
|
Append a new element to the end of the list.
|
|
Free all resources associated with the given linked list. Embedded data will be freed by use of the callback registered at list creation.
|
|
Returns the first list element.
|
|
Remove all elements from the list without destroying the list itself. Embedded data will be freed by use of the callback registered at list creation.
|
|
Returns the list element at the specified index or NULL if the index is invalid.
|
|
Creates a new linked list.
|
|
Returns the next list element. Before using this function you should call list_first to initialize the iterator.
|
|
Returns the number of elements in the list.
|