79
79
#define DRMLISTEMPTY(__item) ((__item)->next == (__item))
81
#define DRMLISTSINGLE(__list) \
82
(!DRMLISTEMPTY(__list) && ((__list)->next == (__list)->prev))
84
#define DRMLISTFOREACH(__item, __list) \
85
for ((__item) = (__list)->next; \
86
(__item) != (__list); (__item) = (__item)->next)
81
88
#define DRMLISTFOREACHSAFE(__item, __temp, __list) \
82
89
for ((__item) = (__list)->next, (__temp) = (__item)->next; \
83
90
(__item) != (__list); \
87
94
for ((__item) = (__list)->prev, (__temp) = (__item)->prev; \
88
95
(__item) != (__list); \
89
96
(__item) = (__temp), (__temp) = (__item)->prev)
98
#define DRMLISTFOREACHENTRY(__item, __list, __head) \
99
for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head); \
100
&(__item)->__head != (__list); \
101
(__item) = DRMLISTENTRY(typeof(*__item), \
102
(__item)->__head.next, __head))
104
#define DRMLISTFOREACHENTRYSAFE(__item, __temp, __list, __head) \
105
for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head), \
106
(__temp) = DRMLISTENTRY(typeof(*__item), \
107
(__item)->__head.next, __head); \
108
&(__item)->__head != (__list); \
109
(__item) = (__temp), \
110
(__temp) = DRMLISTENTRY(typeof(*__item), \
111
(__temp)->__head.next, __head))
113
#define DRMLISTJOIN(__list, __join) if (!DRMLISTEMPTY(__list)) { \
114
(__list)->next->prev = (__join); \
115
(__list)->prev->next = (__join)->next; \
116
(__join)->next->prev = (__list)->prev; \
117
(__join)->next = (__list)->next; \