Lines Matching refs:name

24 #define LIST_HEAD(t,name)                                               \
25 t *name
28 #define LIST_FIELDS(t,name) \
29 t *name##_next, *name##_prev
38 #define LIST_INIT(name,item) \
42 _item->name##_prev = _item->name##_next = NULL; \
46 #define LIST_PREPEND(name,head,item) \
50 if ((_item->name##_next = *_head)) \
51 _item->name##_next->name##_prev = _item; \
52 _item->name##_prev = NULL; \
57 #define LIST_APPEND(name,head,item) \
60 LIST_FIND_TAIL(name,head,_tail); \
61 LIST_INSERT_AFTER(name,head,_tail,item); \
65 #define LIST_REMOVE(name,head,item) \
69 if (_item->name##_next) \
70 _item->name##_next->name##_prev = _item->name##_prev; \
71 if (_item->name##_prev) \
72 _item->name##_prev->name##_next = _item->name##_next; \
75 *_head = _item->name##_next; \
77 _item->name##_next = _item->name##_prev = NULL; \
81 #define LIST_FIND_HEAD(name,item,head) \
87 while (_item->name##_prev) \
88 _item = _item->name##_prev; \
94 #define LIST_FIND_TAIL(name,item,tail) \
100 while (_item->name##_next) \
101 _item = _item->name##_next; \
107 #define LIST_INSERT_AFTER(name,head,a,b) \
112 if ((_b->name##_next = *_head)) \
113 _b->name##_next->name##_prev = _b; \
114 _b->name##_prev = NULL; \
117 if ((_b->name##_next = _a->name##_next)) \
118 _b->name##_next->name##_prev = _b; \
119 _b->name##_prev = _a; \
120 _a->name##_next = _b; \
125 #define LIST_INSERT_BEFORE(name,head,a,b) \
131 _b->name##_next = NULL; \
132 _b->name##_prev = NULL; \
136 while (_tail->name##_next) \
137 _tail = _tail->name##_next; \
138 _b->name##_next = NULL; \
139 _b->name##_prev = _tail; \
140 _tail->name##_next = _b; \
143 if ((_b->name##_prev = _a->name##_prev)) \
144 _b->name##_prev->name##_next = _b; \
145 _b->name##_next = _a; \
146 _a->name##_prev = _b; \
150 #define LIST_JUST_US(name,item) \
151 (!(item)->name##_prev && !(item)->name##_next) \
153 #define LIST_FOREACH(name,i,head) \
154 for ((i) = (head); (i); (i) = (i)->name##_next)
156 #define LIST_FOREACH_SAFE(name,i,n,head) \
157 for ((i) = (head); (i) && (((n) = (i)->name##_next), 1); (i) = (n))
159 #define LIST_FOREACH_BEFORE(name,i,p) \
160 for ((i) = (p)->name##_prev; (i); (i) = (i)->name##_prev)
162 #define LIST_FOREACH_AFTER(name,i,p) \
163 for ((i) = (p)->name##_next; (i); (i) = (i)->name##_next)
166 #define LIST_FOREACH_OTHERS(name,i,p) \
169 while ((i) && (i)->name##_prev) \
170 (i) = (i)->name##_prev; \
172 (i) = (p)->name##_next; \
175 (i) = (i)->name##_next == (p) ? (p)->name##_next : (i)->name##_next)
179 #define LIST_LOOP_BUT_ONE(name,i,head,p) \
180 for ((i) = (p)->name##_next ? (p)->name##_next : (head); \
182 (i) = (i)->name##_next ? (i)->name##_next : (head))