#include <assert.h>
#include <string.h>
#include "list.h"
#include <stdlib.h>
Functions | |
void | ListInit (list_t *prList, void(*destroy)(void *data)) |
Initialise data members of a list. | |
void | ListDestroy (list_t *prList) |
Calls user defined function to free data in list and resets the list to NULL. Call even if your destroy function is NULL. | |
int | ListInsertNext (list_t *prList, list_elem_t *prElement, const void *pvData) |
Insert data next to given element. | |
int | ListRemoveNext (list_t *prList, list_elem_t *prElement, void **pvData_p) |
Remove next element from current element/position. | |
int | IntListInsertNext (list_t *prList, list_elem_t *prElement, const int data) |
Insert int next to given element. | |
int | IntListRemoveNext (list_t *prList, list_elem_t *prElement, int *iData_p) |
Remove next element from current element/position. |
int IntListInsertNext | ( | list_t * | prList, | |
list_elem_t * | prElement, | |||
const int | data | |||
) |
Insert int next to given element.
[in] | prList | List into which to insert |
[in] | prElement | Current position/element. Element after which to insert. If NULL head is used. |
[in] | data | int to store |
int IntListRemoveNext | ( | list_t * | prList, | |
list_elem_t * | prElement, | |||
int * | iData_p | |||
) |
Remove next element from current element/position.
[in] | prList | List from which an element is to be removed. |
[in] | prElement | Current element/position. Next item will be removed. If NULL head is used. |
[out] | iData_p | Will be pointed to removed elements data. |
void ListDestroy | ( | list_t * | prList | ) |
Calls user defined function to free data in list and resets the list to NULL. Call even if your destroy function is NULL.
[in] | prList | The list to destroy |
void ListInit | ( | list_t * | prList, | |
void(*)(void *data) | destroy | |||
) |
Initialise data members of a list.
[in] | prList | List to initialise |
[in] | destroy | A function to be called with pointer to data when destroying the list. NULL if in doubt, free in most other cases. Note: doxygen will always fail to parse this... |
int ListInsertNext | ( | list_t * | prList, | |
list_elem_t * | prElement, | |||
const void * | pvData | |||
) |
Insert data next to given element.
[in] | prList | List into which to insert |
[in] | prElement | Current position/element. Element after which to insert. If NULL head is used. |
[in] | pvData | Pointer to data to store |
int ListRemoveNext | ( | list_t * | prList, | |
list_elem_t * | prElement, | |||
void ** | pvData_p | |||
) |
Remove next element from current element/position.
[in] | prList | List from which an element is to be removed. |
[in] | prElement | Current element/position. Next item will be removed. If NULL head is used. |
[out] | pvData_p | Will be pointed to removed elements data. |