|
libusual
0.1
|
Circular doubly linked list. More...
Data Structures | |
| struct | List |
| Structure for both list nodes and heads. More... | |
Defines | |
| #define | LIST(var) |
| Define and initialize emtpy list head. | |
| #define | list_pop_type(list, typ, field) |
| Remove first elem from list and return with casting. | |
| #define | list_for_each(item, list) |
| Loop over list. | |
| #define | list_for_each_reverse(item, list) |
| Loop over list backwards. | |
| #define | list_for_each_safe(item, list, tmp) |
| Loop over list and allow removing item. | |
| #define | list_for_each_reverse_safe(item, list, tmp) |
| Loop over list backwards and allow removing item. | |
Typedefs | |
| typedef int(* | list_cmp_f )(const struct List *a, const struct List *b) |
| Comparator function signature for list_sort() | |
Functions | |
| static void | list_init (struct List *list) |
| Initialize empty list head. | |
| static int | list_empty (const struct List *list) |
| Is list empty? | |
| static struct List * | list_prepend (struct List *list, struct List *item) |
| Add item to the start of the list. | |
| static struct List * | list_append (struct List *list, struct List *item) |
| Add item to the end of the list. | |
| static struct List * | list_del (struct List *item) |
| Remove item from list. | |
| static struct List * | list_pop (struct List *list) |
| Remove first from list and return. | |
| static struct List * | list_first (const struct List *list) |
| Get first elem from list. | |
| static struct List * | list_last (const struct List *list) |
| Get last elem from list. | |
| void | list_sort (struct List *list, list_cmp_f cmp_func) |
| Sort list. | |
Circular doubly linked list.
| #define LIST | ( | var | ) |
Define and initialize emtpy list head.
| #define list_pop_type | ( | list, | |
| typ, | |||
| field | |||
| ) |
Remove first elem from list and return with casting.
| #define list_for_each | ( | item, | |
| list | |||
| ) |
Loop over list.
| #define list_for_each_reverse | ( | item, | |
| list | |||
| ) |
Loop over list backwards.
| #define list_for_each_safe | ( | item, | |
| list, | |||
| tmp | |||
| ) |
Loop over list and allow removing item.
| #define list_for_each_reverse_safe | ( | item, | |
| list, | |||
| tmp | |||
| ) |
Loop over list backwards and allow removing item.
| typedef int(* list_cmp_f)(const struct List *a, const struct List *b) |
Comparator function signature for list_sort()
| static int list_empty | ( | const struct List * | list | ) | [inline, static] |
Is list empty?
References List::next.
Referenced by list_first(), list_last(), list_pop(), and statlist_empty().
| static struct List* list_prepend | ( | struct List * | list, |
| struct List * | item | ||
| ) | [static, read] |
Add item to the start of the list.
References List::next, and List::prev.
Referenced by statlist_prepend(), and statlist_put_after().
| static struct List* list_append | ( | struct List * | list, |
| struct List * | item | ||
| ) | [static, read] |
Add item to the end of the list.
References List::next, and List::prev.
Referenced by statlist_append(), and statlist_put_before().
Remove item from list.
References List::next, and List::prev.
Referenced by list_pop(), and statlist_remove().
Remove first from list and return.
References list_del(), list_empty(), and List::next.
Referenced by statlist_pop().
| static struct List* list_first | ( | const struct List * | list | ) | [static, read] |
| void list_sort | ( | struct List * | list, |
| list_cmp_f | cmp_func | ||
| ) |
Sort list.
This implementation uses stable merge sort which operates in-place.
1.7.6.1