448: #define CIRCLEQ_HEAD_INITIALIZER(head) \
449: { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
450:
465: #define CIRCLEQ_EMPTY(head) \
466: (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
467:
469: for((var) = CIRCLEQ_FIRST(head); \
470: (var) != CIRCLEQ_END(head); \
471: (var) = CIRCLEQ_NEXT(var, field))
474: for ((var) = CIRCLEQ_FIRST(head); \
475: (var) != CIRCLEQ_END(head) && \
476: ((tvar) = CIRCLEQ_NEXT(var, field), 1); \
480: for((var) = CIRCLEQ_LAST(head); \
481: (var) != CIRCLEQ_END(head); \
482: (var) = CIRCLEQ_PREV(var, field))
485: for ((var) = CIRCLEQ_LAST(head, headname); \
486: (var) != CIRCLEQ_END(head) && \
487: ((tvar) = CIRCLEQ_PREV(var, headname, field), 1); \
493: #define CIRCLEQ_INIT(head) do { \
494: (head)->cqh_first = CIRCLEQ_END(head); \
495: (head)->cqh_last = CIRCLEQ_END(head); \
496: } while (0)
500: (elm)->field.cqe_prev = (listelm); \
501: if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
502: (head)->cqh_last = (elm); \
510: (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
511: if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
512: (head)->cqh_first = (elm); \
519: (elm)->field.cqe_next = (head)->cqh_first; \
520: (elm)->field.cqe_prev = CIRCLEQ_END(head); \
521: if ((head)->cqh_last == CIRCLEQ_END(head)) \
522: (head)->cqh_last = (elm); \
528: #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
529: (elm)->field.cqe_next = CIRCLEQ_END(head); \
530: (elm)->field.cqe_prev = (head)->cqh_last; \
531: if ((head)->cqh_first == CIRCLEQ_END(head)) \
532: (head)->cqh_first = (elm); \
538: #define CIRCLEQ_REMOVE(head, elm, field) do { \
539: if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
540: (head)->cqh_last = (elm)->field.cqe_prev; \
543: (elm)->field.cqe_prev; \
544: if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
545: (head)->cqh_first = (elm)->field.cqe_next; \
554: if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
555: CIRCLEQ_END(head)) \
556: (head).cqh_last = (elm2); \
559: if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
560: CIRCLEQ_END(head)) \
561: (head).cqh_first = (elm2); \