mUPnP for C
list.c File Reference
#include <mupnp/util/list.h>
#include <mupnp/util/log.h>

Functions

void mupnp_list_header_init (mUpnpList *list)
 
void mupnp_list_node_init (mUpnpList *list)
 
int mupnp_list_size (mUpnpList *headList)
 
mUpnpListmupnp_list_get (mUpnpList *headList, int index)
 
void mupnp_list_insert (mUpnpList *prevList, mUpnpList *list)
 
void mupnp_list_add (mUpnpList *headList, mUpnpList *list)
 
void mupnp_list_remove (mUpnpList *list)
 
mUpnpListmupnp_list_prev_circular (mUpnpList *list)
 
mUpnpListmupnp_list_prev (mUpnpList *list)
 
mUpnpListmupnp_list_next_circular (mUpnpList *list)
 
mUpnpListmupnp_list_next (mUpnpList *list)
 
void mupnp_list_clear (mUpnpList *headList, MUPNP_LIST_DESTRUCTORFUNC destructorFunc)
 

Function Documentation

◆ mupnp_list_add()

void mupnp_list_add ( mUpnpList * headList,
mUpnpList * list )
Todo

This works essentially like insert, although it is more error-prone?!

There might be a bug in this function.

◆ mupnp_list_clear()

void mupnp_list_clear ( mUpnpList * headList,
MUPNP_LIST_DESTRUCTORFUNC destructorFunc )

Clear the list and delete all of its contents with MUPNP_LIST_DESTRUCTORFUNC

Parameters
headListList header
destructorFuncFunction pointer that clears the contents of individual nodes

◆ mupnp_list_get()

mUpnpList * mupnp_list_get ( mUpnpList * headList,
int index )

Get an item from the list by the item's index

Parameters
headListList header
indexThe index of the item to get

◆ mupnp_list_header_init()

void mupnp_list_header_init ( mUpnpList * list)

Initialize a list node to act as the first node

Parameters
listList node

◆ mupnp_list_insert()

void mupnp_list_insert ( mUpnpList * prevList,
mUpnpList * list )

Insert a list node or a complete list structure after the given node

Parameters
prevListInsert after this node
listList node or list structure to insert

◆ mupnp_list_next()

mUpnpList * mupnp_list_next ( mUpnpList * list)

Get the next node. Returns NULL if end has been reached.

Parameters
listCurrent node

◆ mupnp_list_next_circular()

mUpnpList * mupnp_list_next_circular ( mUpnpList * list)

Get the next node. Wrap around if the end has been reached.

Parameters
listCurrent node

◆ mupnp_list_node_init()

void mupnp_list_node_init ( mUpnpList * list)

Initialize a list node to act as a regular node, part of a list.

Parameters
listList node

◆ mupnp_list_prev()

mUpnpList * mupnp_list_prev ( mUpnpList * list)

Get the previous node. Returns NULL if beginning has been reached

Parameters
listCurrent node

◆ mupnp_list_prev_circular()

mUpnpList * mupnp_list_prev_circular ( mUpnpList * list)

Get the previous node. Wrap around if the beginning has been reached.

Parameters
listCurrent node

◆ mupnp_list_remove()

void mupnp_list_remove ( mUpnpList * list)

Remove a node from a list. Does not free any memory, but only removes the next and previous link associations regarding the given node.

Parameters
listList node to remove

◆ mupnp_list_size()

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.

Parameters
headListList header