Data Structures | |
struct | ListElmt_ |
Define a structure for linked list elements. More... | |
struct | List_ |
Define a structure for linked lists. More... | |
Defines | |
#define | list_size(list) ((list)->size) |
get list size | |
#define | list_head(list) ((list)->head) |
get first element | |
#define | list_tail(list) ((list)->tail) |
get last element | |
#define | list_is_head(list, element) ((element) == (list)->head ? 1 : 0) |
is it head of list | |
#define | list_is_tail(element) ((element)->next == NULL ? 1 : 0) |
is it tail of list | |
#define | list_data(element) ((element)->data) |
get data of element | |
#define | list_next(element) ((element)->next) |
get next element | |
Typedefs | |
typedef ListElmt_ | ListElmt |
Define a structure for linked list elements. | |
typedef List_ | List |
Define a structure for linked lists. | |
Functions | |
void | list_init (List *list, int(*match)(const void *key1, const void *key2), void(*destroy)(void *data)) |
Initialize link list. | |
void | list_destroy (List *list) |
Destroy link list. | |
int | list_getsize (List *list) |
Get number of elements in list. | |
int | list_insert (List *list, void *data) |
Insert element in link list. | |
int | list_lookup (List *list, void **data) |
Lookup for element in link list. | |
int | list_foreach_match (List *list, int(*matchfunc)(const void *key1, const void *key2), void(*cbfunc)(const void *data), void **data) |
Lookup for element in link list and call function for each match. | |
int | list_for_each_call (List *list, int(*func)(void *data, void *userdata), void *userdata) |
Iterate over each element of link list and call function. | |
int | list_remove_each_if_func_eq_1 (List *list, int(*func)(void *data, void *userdata), void *userdata) |
Remove each element from link list, where function returns 1. | |
int | list_remove (List *list, void **data) |
Remove element from link list. | |
int | list_ins_next (List *list, ListElmt *element, const void *data) |
Insert element in link list. | |
int | list_rem_next (List *list, ListElmt *element, void **data) |
Remove element from link list. | |
int | stringMatchFunction (const void *key1, const void *key2) |
Simple match function for strings. | |
void | stringFreeFunction (void *ptr) |
Simple free function for strings. | |
int | list_internal_lookup (List *list, void **data) |
Lookup for element in link list. |
|
Destroy link list.
Definition at line 39 of file linklist.c. References List_::destroy, List, list_rem_next(), list_size, List_::rwlock, T_RDWR_WLOCK, and T_RDWR_WUNLOCK. Referenced by chtbl_destroy(). |
|
Iterate over each element of link list and call function.
Definition at line 125 of file linklist.c. References ListElmt_::data, List, list_head, list_next, ListElmt, List_::rwlock, T_RDWR_RLOCK, and T_RDWR_RUNLOCK. |
|
Lookup for element in link list and call function for each match.
Definition at line 184 of file linklist.c. References List, list_data, list_head, list_next, ListElmt, List_::rwlock, T_RDWR_RLOCK, and T_RDWR_RUNLOCK. |
|
Get number of elements in list.
Definition at line 66 of file linklist.c. References List, list_size, List_::rwlock, T_RDWR_RLOCK, and T_RDWR_RUNLOCK. Referenced by chtbl_size(). |
|
Initialize link list.
Definition at line 11 of file linklist.c. References List_::destroy, List_::head, List, List_::match, List_::rwlock, List_::size, T_RDWR_INIT, and List_::tail. Referenced by chtbl_init(). |
|
Insert element in link list.
Definition at line 83 of file linklist.c. References List, list_ins_next(), list_internal_lookup(), List_::rwlock, T_RDWR_WLOCK, and T_RDWR_WUNLOCK. Referenced by chtbl_insert(). |
|
Lookup for element in link list.
Definition at line 108 of file linklist.c. References List, list_internal_lookup(), List_::rwlock, T_RDWR_RLOCK, and T_RDWR_RUNLOCK. Referenced by chtbl_lookup(). |
|
Remove element from link list.
Definition at line 208 of file linklist.c. References List, list_data, list_head, list_next, list_rem_next(), ListElmt, List_::match, List_::rwlock, T_RDWR_WLOCK, and T_RDWR_WUNLOCK. Referenced by chtbl_remove(). |
|
Remove each element from link list, where function returns 1.
Definition at line 150 of file linklist.c. References List_::destroy, List, list_data, list_head, list_next, list_rem_next(), ListElmt, List_::rwlock, T_RDWR_WLOCK, and T_RDWR_WUNLOCK. |