|
mUPnP for C
|
Functions | |
| void | mupnp_list_header_init (mUpnpList *list) |
| Initialize a list node as a list header (sentinel node) | |
| void | mupnp_list_node_init (mUpnpList *list) |
| Initialize a list node as a regular data node. | |
| int | mupnp_list_size (mUpnpList *headList) |
| mUpnpList * | mupnp_list_get (mUpnpList *headList, int index) |
| void | mupnp_list_insert (mUpnpList *prevList, mUpnpList *list) |
| Insert a node or list segment after a given node. | |
| void | mupnp_list_add (mUpnpList *headList, mUpnpList *list) |
| Add a node to the end of a list. | |
| void | mupnp_list_remove (mUpnpList *list) |
| Remove a node from its list. | |
| mUpnpList * | mupnp_list_prev_circular (mUpnpList *list) |
| mUpnpList * | mupnp_list_prev (mUpnpList *list) |
| mUpnpList * | mupnp_list_next_circular (mUpnpList *list) |
| mUpnpList * | mupnp_list_next (mUpnpList *list) |
| void | mupnp_list_clear (mUpnpList *headList, MUPNP_LIST_DESTRUCTORFUNC destructorFunc) |
Add a node to the end of a list.
Appends a node to the end of a list (just before the header node). This is a convenience function for adding elements to the tail of a list.
| headList | The list header node. Must not be NULL and must be initialized with mupnp_list_header_init(). |
| list | The node to add. Must not be NULL and should be initialized with mupnp_list_node_init(). |
| void mupnp_list_clear | ( | mUpnpList * | headList, |
| MUPNP_LIST_DESTRUCTORFUNC | destructorFunc ) |
Clear the list and delete all of its contents with MUPNP_LIST_DESTRUCTORFUNC
| headList | List header |
| destructorFunc | Function pointer that clears the contents of individual nodes |
Get an item from the list by the item's index
| headList | List header |
| index | The index of the item to get |
| void mupnp_list_header_init | ( | mUpnpList * | list | ) |
Initialize a list node as a list header (sentinel node)
Initializes a node to act as a circular doubly-linked list header. The header is a sentinel node that marks the beginning and end of the list. It simplifies list operations by eliminating special cases for empty lists.
After initialization:
| list | The node to initialize as a header. Must not be NULL. |
Insert a node or list segment after a given node.
Inserts a single node or an entire list segment immediately after the specified node in the list. This maintains the circular doubly-linked structure and properly updates all prev/next pointers.
If inserting multiple nodes, they should already be linked together (forming a chain).
| prevList | The node after which to insert. Must not be NULL and should be part of a properly initialized list. |
| list | The node or list segment to insert. Must not be NULL. |
Get the next node. Returns NULL if end has been reached.
| list | Current node |
Get the next node. Wrap around if the end has been reached.
| list | Current node |
| void mupnp_list_node_init | ( | mUpnpList * | list | ) |
Initialize a list node as a regular data node.
Initializes a node to act as a regular list member (not a header). The node is initially not linked to any list.
After initialization:
| list | The node to initialize. Must not be NULL. |
Get the previous node. Returns NULL if beginning has been reached
| list | Current node |
Get the previous node. Wrap around if the beginning has been reached.
| list | Current node |
| void mupnp_list_remove | ( | mUpnpList * | list | ) |
Remove a node from its list.
Removes a node from the list it belongs to by updating the prev/next pointers of adjacent nodes. This does NOT free any memory; it only unlinks the node from the list structure.
After removal, the node's prev and next pointers point to itself, making it safe to check if a node is in a list.
| list | The node to remove. Must not be NULL and should be part of a list (not a standalone node). |
| int mupnp_list_size | ( | mUpnpList * | headList | ) |
Get the number of nodes in the current list structure. Counts forwards from the given node, so if you want to get the complete size, give a header node as the parameter.
| headList | List header |