26 #define container_of(ptr, type, member) ((type *)((char *)(ptr)-offsetof(type, member)))
51 #define CRINIT_LIST_INIT(list) \
109 for (cur = list->
next; cur != list; cur = cur->
next) {
110 if (entryCmp(cur, entry) >= 0) {
149 return list->
next == list;
159 #define crinitListEntry(entry, type, member) container_of(entry, type, member)
168 #define crinitListFirstEntry(list, type, member) crinitListEntry((list)->next, type, member)
177 #define crinitListLastEntry(list, type, member) crinitListEntry((list)->prev, type, member)
185 #define crinitListPrevEntry(entry, member) crinitListEntry((entry)->member.prev, __typeof(*(entry)), member)
193 #define crinitListNextEntry(entry, member) crinitListEntry((entry)->member.next, __typeof(*(entry)), member)
202 #define crinitListEntryIsHead(entry, list, member) (&(entry)->member == (list))
211 #define crinitListForEachEntry(entry, list, member) \
212 for ((entry) = crinitListFirstEntry(list, __typeof(*(entry)), member); \
213 !crinitListEntryIsHead(entry, list, member); (entry) = crinitListNextEntry(entry, member))
226 #define crinitListForEachEntrySafe(entry, temp, list, member) \
227 for ((entry) = crinitListFirstEntry(list, __typeof(*(entry)), member), \
228 (temp) = crinitListNextEntry(entry, member); \
229 !crinitListEntryIsHead(entry, list, member); (entry) = (temp), (temp) = crinitListNextEntry(temp, member))
struct crinitList crinitList_t
static void crinitListInsert(crinitList_t *entry, crinitList_t *prev, crinitList_t *next)
Definition: list.h:72
static int crinitListIsEmpty(const crinitList_t *list)
Definition: list.h:148
static void crinitListInsertSorted(crinitList_t *list, crinitList_t *entry, crinitListCmp_t entryCmp)
Definition: list.h:106
static void crinitListDelete(crinitList_t *entry)
Definition: list.h:132
static void crinitListInit(crinitList_t *list)
Definition: list.h:60
int(* crinitListCmp_t)(crinitList_t *e1, crinitList_t *e2)
Definition: list.h:43
static void crinitListAppend(crinitList_t *list, crinitList_t *entry)
Definition: list.h:95
static void crinitListPrepend(crinitList_t *list, crinitList_t *entry)
Definition: list.h:85
struct crinitList * next
Pointer to next entry in list.
Definition: list.h:33
struct crinitList * prev
Pointer to last entry in list.
Definition: list.h:32