Skip to content

Commit 947047b

Browse files
triplefrokhinip
authored andcommitted
Added missing macros in generic_sys_queue.h
Signed-off-by: Kim Topley <ktopley@apple.com>
1 parent 96c2846 commit 947047b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/shims/generic_sys_queue.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,24 @@
110110
struct type *le_prev; \
111111
}
112112

113+
#define LIST_EMPTY(head) ((head)->lh_first == NULL)
114+
113115
#define LIST_FIRST(head) ((head)->lh_first)
114116

115117
#define LIST_FOREACH(var, head, field) \
116118
for ((var) = LIST_FIRST((head)); \
117119
(var); \
118120
(var) = LIST_NEXT((var), field))
119121

122+
#define LIST_FOREACH_SAFE(var, head, field, tvar) \
123+
for ((var) = LIST_FIRST((head)); \
124+
(var) && ((tvar) = LIST_NEXT((var), field), 1); \
125+
(var) = (tvar))
126+
127+
#define LIST_INIT(head) do { \
128+
LIST_FIRST((head)) = NULL; \
129+
} while (0)
130+
120131
#define LIST_NEXT(elm, field) ((elm)->field.le_next)
121132

122133
#define LIST_REMOVE(elm, field) do { \
File renamed without changes.

0 commit comments

Comments
 (0)