206 tommy_list_insert_head_not_empty(list, node);
208 tommy_list_insert_first(list, node);
224 tommy_list_insert_tail_not_empty(head, node);
226 tommy_list_insert_first(list, node);
274 if (second_head == 0)
279 if (first_head == 0) {
285 first_tail = first_head->
prev;
288 first_head->
prev = second_head->
prev;
289 second_head->
prev = first_tail;
292 first_tail->
next = second_head;
363 void* data = node->
data;
377 void* data = node->
data;
Data structure node.
Definition: tommytypes.h:211
struct tommy_node_struct * next
Next node.
Definition: tommytypes.h:216
struct tommy_node_struct * prev
Previous node.
Definition: tommytypes.h:222
void * data
Pointer to the object containing the node.
Definition: tommytypes.h:228
void tommy_list_foreach_arg(tommy_list *list, tommy_foreach_arg_func *func, void *arg)
Calls the specified function with an argument for each element in the list.
Definition: tommylist.h:372
void tommy_list_init(tommy_list *list)
Initializes the list.
Definition: tommylist.h:114
void tommy_list_insert_head(tommy_list *list, tommy_node *node, void *data)
Inserts an element at the head of a list.
Definition: tommylist.h:201
tommy_node * tommy_list
Doubly linked list type.
Definition: tommylist.h:108
void * tommy_list_remove_existing(tommy_list *list, tommy_node *node)
Removes an element from the list.
Definition: tommylist.h:240
tommy_node * tommy_list_tail(tommy_list *list)
Gets the tail of the list.
Definition: tommylist.h:132
void tommy_list_insert_tail(tommy_list *list, tommy_node *node, void *data)
Inserts an element at the tail of a list.
Definition: tommylist.h:219
void tommy_list_concat(tommy_list *first, tommy_list *second)
Concats two lists.
Definition: tommylist.h:266
tommy_bool_t tommy_list_empty(tommy_list *list)
Checks if empty.
Definition: tommylist.h:308
TOMMY_API void tommy_list_sort(tommy_list *list, tommy_compare_func *cmp)
Sorts a list.
tommy_size_t tommy_list_count(tommy_list *list)
Gets the number of elements.
Definition: tommylist.h:317
tommy_node * tommy_list_head(tommy_list *list)
Gets the head of the list.
Definition: tommylist.h:123
void tommy_list_foreach(tommy_list *list, tommy_foreach_func *func)
Calls the specified function for each element in the list.
Definition: tommylist.h:358
int tommy_compare_func(const void *obj_a, const void *obj_b)
Compare function for elements.
Definition: tommytypes.h:269
uint64_t tommy_size_t
Generic size_t type.
Definition: tommytypes.h:60
void tommy_foreach_func(void *obj)
Foreach function.
Definition: tommytypes.h:318
void tommy_foreach_arg_func(void *arg, void *obj)
Foreach function with an argument.
Definition: tommytypes.h:325
int tommy_bool_t
Generic boolean type.
Definition: tommytypes.h:72