54 #ifndef __SOLAR_CAPTURE_DLIST_H__
55 #define __SOLAR_CAPTURE_DLIST_H__
71 #define SC_CONTAINER(c_type, mbr_name, p_mbr) \
72 ( (c_type*) ((char*)(p_mbr) - SC_MEMBER_OFFSET(c_type, mbr_name)) )
83 #define SC_DLIST_FOR_EACH_OBJ(list, iter, mbr) \
84 for( (iter) = SC_CONTAINER(typeof(*(iter)), mbr, (list)->next); \
85 &(iter)->mbr != (list); \
86 (iter) = SC_CONTAINER(typeof(*(iter)), mbr, (iter)->mbr.next) )
96 #define SC_DLIST_FOR_EACH_OBJ_SAFE(list, iter, next_entry, mbr) \
97 for( (iter) = SC_CONTAINER(typeof(*(iter)), mbr, (list)->next), \
98 (next_entry) = SC_CONTAINER(typeof(*(iter)), mbr, (iter)->mbr.next); \
99 &(iter)->mbr != (list); \
100 (iter) = (next_entry), \
101 (next_entry) = SC_CONTAINER(typeof(*(iter)), mbr, (iter)->mbr.next) )
117 return list->
next == list;
static void sc_dlist_init(struct sc_dlist *list)
Initialise a pre-allocated sc_dlist to be an empty doubly linked list.
Definition: dlist.h:107
static void sc_dlist_remove(struct sc_dlist *l)
Remove an item from the list.
Definition: dlist.h:145
Doubly linked list pointers.
Definition: dlist.h:60
static struct sc_dlist * sc_dlist_pop_tail(struct sc_dlist *list)
Pop the tail of a list.
Definition: dlist.h:165
struct sc_dlist * next
Definition: dlist.h:62
static int sc_dlist_is_empty(const struct sc_dlist *list)
Check if a doubly linked list is empty, returns 1 if true 0 otherwise.
Definition: dlist.h:115
struct sc_dlist * prev
Definition: dlist.h:61
static struct sc_dlist * sc_dlist_pop_head(struct sc_dlist *list)
Pop off the head of a list.
Definition: dlist.h:154
static void sc_dlist_push_head(struct sc_dlist *list, struct sc_dlist *l)
Prepend an item to the head of a doubly-linked list.
Definition: dlist.h:124
static void sc_dlist_push_tail(struct sc_dlist *list, struct sc_dlist *l)
Append an item to the tail of a doubly-linked list.
Definition: dlist.h:135