Lines Matching refs:head
69 * added to the list after an existing element or at the head of the list.
70 * Elements being removed from the head of the list should use the explicit
77 * head of the list and the other to the tail of the list. The elements are
80 * to the list after an existing element, at the head of the list, or at the
81 * end of the list. Elements being removed from the head of the tail queue
91 * or after an existing element or at the head of the list. A list
94 * A tail queue is headed by a pair of pointers, one to the head of the
98 * after an existing element, at the head of the list, or at the end of
101 * A circle queue is headed by a pair of pointers, one to the head of the
105 * an existing element, at the head of the list, or at the end of the list.
109 * new head or tail.
143 #define LDAP_SLIST_HEAD_INITIALIZER(head) \
157 #define LDAP_SLIST_EMPTY(head) ((head)->slh_first == NULL)
159 #define LDAP_SLIST_FIRST(head) ((head)->slh_first)
161 #define LDAP_SLIST_FOREACH(var, head, field) \
162 for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
164 #define LDAP_SLIST_INIT(head) { \
165 (head)->slh_first = NULL; \
177 #define LDAP_SLIST_INSERT_HEAD(head, elm, field) do { \
178 (elm)->field.sle_next = (head)->slh_first; \
179 (head)->slh_first = (elm); \
184 #define LDAP_SLIST_REMOVE_HEAD(head, field) do { \
185 (head)->slh_first = (head)->slh_first->field.sle_next; \
188 #define LDAP_SLIST_REMOVE(head, elm, type, field) do { \
189 if ((head)->slh_first == (elm)) { \
190 LDAP_SLIST_REMOVE_HEAD((head), field); \
193 struct type *curelm = (head)->slh_first; \
210 #define LDAP_STAILQ_HEAD_INITIALIZER(head) \
211 { NULL, &(head).stqh_first }
224 #define LDAP_STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
226 #define LDAP_STAILQ_INIT(head) do { \
227 (head)->stqh_first = NULL; \
228 (head)->stqh_last = &(head)->stqh_first; \
235 #define LDAP_STAILQ_FIRST(head) ((head)->stqh_first)
237 #define LDAP_STAILQ_LAST(head, type, field) \
238 (LDAP_STAILQ_EMPTY(head) ? \
241 ((char *)((head)->stqh_last) - offsetof(struct type, field))))
243 #define LDAP_STAILQ_FOREACH(var, head, field) \
244 for((var) = (head)->stqh_first; (var); (var) = (var)->field.stqe_next)
246 #define LDAP_STAILQ_INSERT_HEAD(head, elm, field) do { \
247 if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \
248 (head)->stqh_last = &(elm)->field.stqe_next; \
249 (head)->stqh_first = (elm); \
252 #define LDAP_STAILQ_INSERT_TAIL(head, elm, field) do { \
254 *(head)->stqh_last = (elm); \
255 (head)->stqh_last = &(elm)->field.stqe_next; \
258 #define LDAP_STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
260 (head)->stqh_last = &(elm)->field.stqe_next; \
266 #define LDAP_STAILQ_REMOVE_HEAD(head, field) do { \
267 if (((head)->stqh_first = \
268 (head)->stqh_first->field.stqe_next) == NULL) \
269 (head)->stqh_last = &(head)->stqh_first; \
272 #define LDAP_STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do { \
273 if (((head)->stqh_first = (elm)->field.stqe_next) == NULL) \
274 (head)->stqh_last = &(head)->stqh_first; \
277 #define LDAP_STAILQ_REMOVE(head, elm, type, field) do { \
278 if ((head)->stqh_first == (elm)) { \
279 LDAP_STAILQ_REMOVE_HEAD(head, field); \
282 struct type *curelm = (head)->stqh_first; \
287 (head)->stqh_last = &(curelm)->field.stqe_next; \
299 #define LDAP_LIST_HEAD_INITIALIZER(head) \
315 #define LDAP_LIST_EMPTY(head) ((head)->lh_first == NULL)
317 #define LDAP_LIST_FIRST(head) ((head)->lh_first)
319 #define LDAP_LIST_FOREACH(var, head, field) \
320 for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next)
322 #define LDAP_LIST_INIT(head) do { \
323 (head)->lh_first = NULL; \
346 #define LDAP_LIST_INSERT_HEAD(head, elm, field) do { \
347 if (((elm)->field.le_next = (head)->lh_first) != NULL) \
348 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
349 (head)->lh_first = (elm); \
350 (elm)->field.le_prev = &(head)->lh_first; \
371 #define LDAP_TAILQ_HEAD_INITIALIZER(head) \
372 { NULL, &(head).tqh_first }
386 #define LDAP_TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
388 #define LDAP_TAILQ_FOREACH(var, head, field) \
389 for (var = LDAP_TAILQ_FIRST(head); var; var = LDAP_TAILQ_NEXT(var, field))
391 #define LDAP_TAILQ_FOREACH_REVERSE(var, head, headname, field) \
392 for ((var) = LDAP_TAILQ_LAST((head), headname); \
396 #define LDAP_TAILQ_FIRST(head) ((head)->tqh_first)
398 #define LDAP_TAILQ_LAST(head, headname) \
399 (*(((struct headname *)((head)->tqh_last))->tqh_last))
406 #define LDAP_TAILQ_INIT(head) do { \
407 (head)->tqh_first = NULL; \
408 (head)->tqh_last = &(head)->tqh_first; \
416 #define LDAP_TAILQ_INSERT_HEAD(head, elm, field) do { \
417 if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
418 (head)->tqh_first->field.tqe_prev = \
421 (head)->tqh_last = &(elm)->field.tqe_next; \
422 (head)->tqh_first = (elm); \
423 (elm)->field.tqe_prev = &(head)->tqh_first; \
426 #define LDAP_TAILQ_INSERT_TAIL(head, elm, field) do { \
428 (elm)->field.tqe_prev = (head)->tqh_last; \
429 *(head)->tqh_last = (elm); \
430 (head)->tqh_last = &(elm)->field.tqe_next; \
433 #define LDAP_TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
438 (head)->tqh_last = &(elm)->field.tqe_next; \
450 #define LDAP_TAILQ_REMOVE(head, elm, field) do { \
455 (head)->tqh_last = (elm)->field.tqe_prev; \
468 #define LDAP_CIRCLEQ_HEAD_INITIALIZER(head) \
469 { (void *)&(head), (void *)&(head) }
480 #define LDAP_CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head))
482 #define LDAP_CIRCLEQ_FIRST(head) ((head)->cqh_first)
484 #define LDAP_CIRCLEQ_FOREACH(var, head, field) \
485 for((var) = (head)->cqh_first; \
486 (var) != (void *)(head); \
489 #define LDAP_CIRCLEQ_FOREACH_REVERSE(var, head, field) \
490 for((var) = (head)->cqh_last; \
491 (var) != (void *)(head); \
494 #define LDAP_CIRCLEQ_INIT(head) do { \
495 (head)->cqh_first = (void *)(head); \
496 (head)->cqh_last = (void *)(head); \
504 #define LDAP_CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
507 if ((listelm)->field.cqe_next == (void *)(head)) \
508 (head)->cqh_last = (elm); \
514 #define LDAP_CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
517 if ((listelm)->field.cqe_prev == (void *)(head)) \
518 (head)->cqh_first = (elm); \
524 #define LDAP_CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
525 (elm)->field.cqe_next = (head)->cqh_first; \
526 (elm)->field.cqe_prev = (void *)(head); \
527 if ((head)->cqh_last == (void *)(head)) \
528 (head)->cqh_last = (elm); \
530 (head)->cqh_first->field.cqe_prev = (elm); \
531 (head)->cqh_first = (elm); \
534 #define LDAP_CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
535 (elm)->field.cqe_next = (void *)(head); \
536 (elm)->field.cqe_prev = (head)->cqh_last; \
537 if ((head)->cqh_first == (void *)(head)) \
538 (head)->cqh_first = (elm); \
540 (head)->cqh_last->field.cqe_next = (elm); \
541 (head)->cqh_last = (elm); \
544 #define LDAP_CIRCLEQ_LAST(head) ((head)->cqh_last)
550 #define LDAP_CIRCLEQ_REMOVE(head, elm, field) do { \
551 if ((elm)->field.cqe_next == (void *)(head)) \
552 (head)->cqh_last = (elm)->field.cqe_prev; \
556 if ((elm)->field.cqe_prev == (void *)(head)) \
557 (head)->cqh_first = (elm)->field.cqe_next; \
563 #define LDAP_CIRCLEQ_LOOP_NEXT(head, elm, field) \
564 (((elm)->field.cqe_next == (void *)(head)) \
565 ? ((head)->cqh_first) \
568 #define LDAP_CIRCLEQ_LOOP_PREV(head, elm, field) \
569 (((elm)->field.cqe_prev == (void *)(head)) \
570 ? ((head)->cqh_last) \
573 #define LDAP_CIRCLEQ_MAKE_HEAD(head, elm, field) do { \
574 if ((elm)->field.cqe_prev != (void *)(head)) { \
575 (head)->cqh_first->field.cqe_prev = (head)->cqh_last; \
576 (head)->cqh_last->field.cqe_next = (head)->cqh_first; \
577 (head)->cqh_first = elm; \
578 (head)->cqh_last = (elm)->field.cqe_prev; \
579 (elm)->field.cqe_prev->field.cqe_next = (void *)(head); \
580 (elm)->field.cqe_prev = (void *)(head); \
584 #define LDAP_CIRCLEQ_MAKE_TAIL(head, elm, field) do { \
585 if ((elm)->field.cqe_next != (void *)(head)) { \
586 (head)->cqh_first->field.cqe_prev = (head)->cqh_last; \
587 (head)->cqh_last->field.cqe_next = (head)->cqh_first; \
588 (head)->cqh_first = (elm)->field.cqe_next; \
589 (head)->cqh_last = elm; \
590 (elm)->field.cqe_next->field.cqe_prev = (void *)(head); \
591 (elm)->field.cqe_next = (void *)(head); \