Go to the source code of this file.
Data Structures | |
| struct | _XList |
Typedefs | |
| typedef struct _XList | XList |
| A doubly linked list. | |
| typedef void *(* | XCloneFunc )(void *data) |
| Signature of a cloning function. | |
| typedef void *(* | XFreeFunc )(void *data) |
| Signature of a freeing function. | |
Functions | |
| XList * | xlist_new (void) |
| Create a new list. | |
| XList * | xlist_clone (XList *list) |
| Clone a list using the default clone function. | |
| XList * | xlist_clone_with (XList *list, XCloneFunc clone) |
| Clone a list using a custom clone function. | |
| XList * | xlist_tail (XList *list) |
| Return the tail element of a list. | |
| XList * | xlist_prepend (XList *list, void *data) |
| Prepend a new node to a list containing given data. | |
| XList * | xlist_append (XList *list, void *data) |
| Append a new node to a list containing given data. | |
| XList * | xlist_add_before (XList *list, void *data, XList *node) |
| Add a new node containing given data before a given node. | |
| XList * | xlist_add_after (XList *list, void *data, XList *node) |
| Add a new node containing given data after a given node. | |
| XList * | xlist_find (XList *list, void *data) |
| Find the first node containing given data in a list. | |
| XList * | xlist_remove (XList *list, XList *node) |
| Remove a node from a list. | |
| int | xlist_length (XList *list) |
| Query the number of items in a list. | |
| int | xlist_is_empty (XList *list) |
| Query if a list is empty, ie. | |
| int | xlist_is_singleton (XList *list) |
| Query if the list is singleton, ie. | |
| XList * | xlist_free_with (XList *list, XFreeFunc free_func) |
| Free a list, using a given function to free each data element. | |
| XList * | xlist_free (XList *list) |
| Free a list, using anx_free() to free each data element. | |
| typedef void*(* XCloneFunc)(void *data) |
Signature of a cloning function.
| typedef void*(* XFreeFunc)(void *data) |
Signature of a freeing function.
Add a new node containing given data after a given node.
| list | the list | |
| data | the data element of the newly created node | |
| node | the node after which to add the newly created node |
References _XList::next, _XList::prev, xlist_node_new(), and xlist_prepend().
Add a new node containing given data before a given node.
| list | the list | |
| data | the data element of the newly created node | |
| node | the node before which to add the newly created node |
References _XList::next, _XList::prev, xlist_append(), xlist_node_new(), and xlist_prepend().
Append a new node to a list containing given data.
| list | the list | |
| data | the data element of the newly created node |
References _XList::next, _XList::prev, xlist_node_new(), and xlist_tail().
Referenced by xlist_add_before(), xlist_clone(), xlist_clone_with(), xtag_new_parse(), and xtag_parse_tag().
Clone a list using the default clone function.
| list | the list to clone |
References _XList::data, _XList::next, xlist_append(), and xlist_new().
Referenced by xlist_clone_with().
| XList* xlist_clone_with | ( | XList * | list, | |
| XCloneFunc | clone | |||
| ) |
Clone a list using a custom clone function.
| list | the list to clone | |
| clone | the function to use to clone a list item |
References _XList::data, _XList::next, xlist_append(), xlist_clone(), and xlist_new().
Find the first node containing given data in a list.
| list | the list | |
| data | the data element to find |
References _XList::data, and _XList::next.
Free a list, using anx_free() to free each data element.
| list | the list |
References _XList::next.
Referenced by xtag_free().
Free a list, using a given function to free each data element.
| list | the list | |
| free_func | a function to free each data element |
References _XList::data, and _XList::next.
| int xlist_is_empty | ( | XList * | list | ) |
Query if a list is empty, ie.
contains no items
| list | the list |
| int xlist_is_singleton | ( | XList * | list | ) |
Query if the list is singleton, ie.
contains exactly one item
| list | the list |
References _XList::next.
| int xlist_length | ( | XList * | list | ) |
Query the number of items in a list.
| list | the list |
References c, and _XList::next.
| XList* xlist_new | ( | void | ) |
Prepend a new node to a list containing given data.
| list | the list | |
| data | the data element of the newly created node |
References _XList::next, _XList::prev, and xlist_node_new().
Referenced by xlist_add_after(), and xlist_add_before().
Remove a node from a list.
References _XList::next, and _XList::prev.
Return the tail element of a list.
| list | the list |
References _XList::next.
Referenced by xlist_append().
1.5.6