116#define LIST_FOREACH(head, iter) \
118 struct list_node *iter = list_first(head), *iter##_next = list_first(head) ? list_next(head, list_first(head)) : NULL; \
120 iter = iter##_next, iter##_next = iter##_next ? list_next(head, iter##_next) : NULL\
struct list_node * list_pop_first(struct list_head *head)
Removes the first node of head's list (aka deque with respect to list_append).
Definition list.c:67
struct list_head * list_extend(struct list_head *head1, struct list_head *head2)
Merges head2 unto head1 at the end of head1 and returns head1.
Definition list.c:39
struct list_node * list_append(struct list_head *head, struct list_node *node)
Inserts node at the end of head's list (aka stack push).
Definition list.c:35
struct list_node * list_first(struct list_head *head)
Definition list.c:53
struct list_node * list_last(struct list_head *head)
Definition list.c:57
struct list_node * list_next(struct list_head *head, struct list_node *node)
Definition list.c:74
bool list_is_empty(const struct list_head *head)
Definition list.c:17
struct list_head * list_init_head(struct list_head *head)
Initializes head as an empty list.
Definition list.c:6
struct list_node * list_insert_before(struct list_node *before, struct list_node *node)
Inserts node before before in the list of before.
Definition list.c:31
struct list_node * list_remove(struct list_node *node)
Removes node from head's list.
Definition list.c:61
struct list_node * list_init_node(struct list_node *node)
Initializes node.
Definition list.c:11
struct list_node * list_prev(struct list_head *head, struct list_node *node)
Definition list.c:77
size_t list_length(struct list_head *head)
Definition list.c:81
struct list_node * list_insert_after(struct list_node *after, struct list_node *node)
Inserts node after after in the list of after.
Definition list.c:21
struct list_node * list_pop_last(struct list_head *head)
Removes the last node of head's list (aka stack pop with respect to list_append).
Definition list.c:70
Anchor for list_node.
Definition list.h:23
Doubly-linked List Node.
Definition list.h:15
struct list_node * next
Definition list.h:16
struct list_node * prev
Definition list.h:17