Home | History | Annotate | Download | only in openbsd-compat

Lines Matching full:head

131  * added to the list after an existing element or at the head of the list.
132 * Elements being removed from the head of the list should use the explicit
142 * or after an existing element or at the head of the list. A list
145 * A simple queue is headed by a pair of pointers, one the head of the
148 * head of the list. New elements can be added to the list before or after
149 * an existing element, at the head of the list, or at the end of the
152 * A tail queue is headed by a pair of pointers, one to the head of the
156 * after an existing element, at the head of the list, or at the end of
159 * A circle queue is headed by a pair of pointers, one to the head of the
163 * an existing element, at the head of the list, or at the end of the list.
184 #define SLIST_HEAD_INITIALIZER(head) \
195 #define SLIST_FIRST(head) ((head)->slh_first)
196 #define SLIST_END(head) NULL
197 #define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
200 #define SLIST_FOREACH(var, head, field) \
201 for((var) = SLIST_FIRST(head); \
202 (var) != SLIST_END(head); \
205 #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
206 for ((varp) = &SLIST_FIRST((head)); \
207 ((var) = *(varp)) != SLIST_END(head); \
213 #define SLIST_INIT(head) { \
214 SLIST_FIRST(head) = SLIST_END(head); \
222 #define SLIST_INSERT_HEAD(head, elm, field) do { \
223 (elm)->field.sle_next = (head)->slh_first; \
224 (head)->slh_first = (elm); \
227 #define SLIST_REMOVE_NEXT(head, elm, field) do { \
231 #define SLIST_REMOVE_HEAD(head, field) do { \
232 (head)->slh_first = (head)->slh_first->field.sle_next; \
235 #define SLIST_REMOVE(head, elm, type, field) do { \
236 if ((head)->slh_first == (elm)) { \
237 SLIST_REMOVE_HEAD((head), field); \
239 struct type *curelm = (head)->slh_first; \
257 #define LIST_HEAD_INITIALIZER(head) \
269 #define LIST_FIRST(head) ((head)->lh_first)
270 #define LIST_END(head) NULL
271 #define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
274 #define LIST_FOREACH(var, head, field) \
275 for((var) = LIST_FIRST(head); \
276 (var)!= LIST_END(head); \
282 #define LIST_INIT(head) do { \
283 LIST_FIRST(head) = LIST_END(head); \
301 #define LIST_INSERT_HEAD(head, elm, field) do { \
302 if (((elm)->field.le_next = (head)->lh_first) != NULL) \
303 (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
304 (head)->lh_first = (elm); \
305 (elm)->field.le_prev = &(head)->lh_first; \
336 #define SIMPLEQ_HEAD_INITIALIZER(head) \
337 { NULL, &(head).sqh_first }
347 #define SIMPLEQ_FIRST(head) ((head)->sqh_first)
348 #define SIMPLEQ_END(head) NULL
349 #define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
352 #define SIMPLEQ_FOREACH(var, head, field) \
353 for((var) = SIMPLEQ_FIRST(head); \
354 (var) != SIMPLEQ_END(head); \
360 #define SIMPLEQ_INIT(head) do { \
361 (head)->sqh_first = NULL; \
362 (head)->sqh_last = &(head)->sqh_first; \
365 #define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
366 if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
367 (head)->sqh_last = &(elm)->field.sqe_next; \
368 (head)->sqh_first = (elm); \
371 #define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
373 *(head)->sqh_last = (elm); \
374 (head)->sqh_last = &(elm)->field.sqe_next; \
377 #define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
379 (head)->sqh_last = &(elm)->field.sqe_next; \
383 #define SIMPLEQ_REMOVE_HEAD(head, field) do { \
384 if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
385 (head)->sqh_last = &(head)->sqh_first; \
397 #define TAILQ_HEAD_INITIALIZER(head) \
398 { NULL, &(head).tqh_first }
409 #define TAILQ_FIRST(head) ((head)->tqh_first)
410 #define TAILQ_END(head) NULL
412 #define TAILQ_LAST(head, headname) \
413 (*(((struct headname *)((head)->tqh_last))->tqh_last))
417 #define TAILQ_EMPTY(head) \
418 (TAILQ_FIRST(head) == TAILQ_END(head))
420 #define TAILQ_FOREACH(var, head, field) \
421 for((var) = TAILQ_FIRST(head); \
422 (var) != TAILQ_END(head); \
425 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
426 for((var) = TAILQ_LAST(head, headname); \
427 (var) != TAILQ_END(head); \
433 #define TAILQ_INIT(head) do { \
434 (head)->tqh_first = NULL; \
435 (head)->tqh_last = &(head)->tqh_first; \
438 #define TAILQ_INSERT_HEAD(head, elm, field) do { \
439 if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
440 (head)->tqh_first->field.tqe_prev = \
443 (head)->tqh_last = &(elm)->field.tqe_next; \
444 (head)->tqh_first = (elm); \
445 (elm)->field.tqe_prev = &(head)->tqh_first; \
448 #define TAILQ_INSERT_TAIL(head, elm, field) do { \
450 (elm)->field.tqe_prev = (head)->tqh_last; \
451 *(head)->tqh_last = (elm); \
452 (head)->tqh_last = &(elm)->field.tqe_next; \
455 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
460 (head)->tqh_last = &(elm)->field.tqe_next; \
472 #define TAILQ_REMOVE(head, elm, field) do { \
477 (head)->tqh_last = (elm)->field.tqe_prev; \
483 #define TAILQ_REPLACE(head, elm, elm2, field) do { \
488 (head)->tqh_last = &(elm2)->field.tqe_next; \
504 #define CIRCLEQ_HEAD_INITIALIZER(head) \
505 { CIRCLEQ_END(&headhead) }
516 #define CIRCLEQ_FIRST(head) ((head)->cqh_first)
517 #define CIRCLEQ_LAST(head) ((head)->cqh_last)
518 #define CIRCLEQ_END(head) ((void *)(head))
521 #define CIRCLEQ_EMPTY(head) \
522 (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
524 #define CIRCLEQ_FOREACH(var, head, field) \
525 for((var) = CIRCLEQ_FIRST(head); \
526 (var) != CIRCLEQ_END(head); \
529 #define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
530 for((var) = CIRCLEQ_LAST(head); \
531 (var) != CIRCLEQ_END(head); \
537 #define CIRCLEQ_INIT(head) do { \
538 (head)->cqh_first = CIRCLEQ_END(head); \
539 (head)->cqh_last = CIRCLEQ_END(head); \
542 #define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
545 if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
546 (head)->cqh_last = (elm); \
552 #define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
555 if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
556 (head)->cqh_first = (elm); \
562 #define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
563 (elm)->field.cqe_next = (head)->cqh_first; \
564 (elm)->field.cqe_prev = CIRCLEQ_END(head); \
565 if ((head)->cqh_last == CIRCLEQ_END(head)) \
566 (head)->cqh_last = (elm); \
568 (head)->cqh_first->field.cqe_prev = (elm); \
569 (head)->cqh_first = (elm); \
572 #define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
573 (elm)->field.cqe_next = CIRCLEQ_END(head); \
574 (elm)->field.cqe_prev = (head)->cqh_last; \
575 if ((head)->cqh_first == CIRCLEQ_END(head)) \
576 (head)->cqh_first = (elm); \
578 (head)->cqh_last->field.cqe_next = (elm); \
579 (head)->cqh_last = (elm); \
582 #define CIRCLEQ_REMOVE(head, elm, field) do { \
583 if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
584 (head)->cqh_last = (elm)->field.cqe_prev; \
588 if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
589 (head)->cqh_first = (elm)->field.cqe_next; \
597 #define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
599 CIRCLEQ_END(head)) \
600 (head).cqh_last = (elm2); \
604 CIRCLEQ_END(head)) \
605 (head).cqh_first = (elm2); \