libite
Macros
queue.h File Reference

Go to the source code of this file.

Macros

#define _SYS_QUEUE_H_
 
#define _Q_INVALIDATE(a)
 
#define SLIST_HEAD(name, type)
 
#define SLIST_HEAD_INITIALIZER(head)   { NULL }
 
#define SLIST_ENTRY(type)
 
#define SLIST_FIRST(head)   ((head)->slh_first)
 
#define SLIST_END(head)   NULL
 
#define SLIST_EMPTY(head)   (SLIST_FIRST(head) == SLIST_END(head))
 
#define SLIST_NEXT(elm, field)   ((elm)->field.sle_next)
 
#define SLIST_FOREACH(var, head, field)
 
#define SLIST_FOREACH_SAFE(var, head, field, tvar)
 
#define SLIST_INIT(head)
 
#define SLIST_INSERT_AFTER(slistelm, elm, field)
 
#define SLIST_INSERT_HEAD(head, elm, field)
 
#define SLIST_REMOVE_AFTER(elm, field)
 
#define SLIST_REMOVE_HEAD(head, field)
 
#define SLIST_REMOVE(head, elm, type, field)
 
#define LIST_HEAD(name, type)
 
#define LIST_HEAD_INITIALIZER(head)   { NULL }
 
#define LIST_ENTRY(type)
 
#define LIST_FIRST(head)   ((head)->lh_first)
 
#define LIST_END(head)   NULL
 
#define LIST_EMPTY(head)   (LIST_FIRST(head) == LIST_END(head))
 
#define LIST_NEXT(elm, field)   ((elm)->field.le_next)
 
#define LIST_FOREACH(var, head, field)
 
#define LIST_FOREACH_SAFE(var, head, field, tvar)
 
#define LIST_INIT(head)
 
#define LIST_INSERT_AFTER(listelm, elm, field)
 
#define LIST_INSERT_BEFORE(listelm, elm, field)
 
#define LIST_INSERT_HEAD(head, elm, field)
 
#define LIST_REMOVE(elm, field)
 
#define LIST_REPLACE(elm, elm2, field)
 
#define SIMPLEQ_HEAD(name, type)
 
#define SIMPLEQ_HEAD_INITIALIZER(head)   { NULL, &(head).sqh_first }
 
#define SIMPLEQ_ENTRY(type)
 
#define SIMPLEQ_FIRST(head)   ((head)->sqh_first)
 
#define SIMPLEQ_END(head)   NULL
 
#define SIMPLEQ_EMPTY(head)   (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
 
#define SIMPLEQ_NEXT(elm, field)   ((elm)->field.sqe_next)
 
#define SIMPLEQ_FOREACH(var, head, field)
 
#define SIMPLEQ_FOREACH_SAFE(var, head, field, tvar)
 
#define SIMPLEQ_INIT(head)
 
#define SIMPLEQ_INSERT_HEAD(head, elm, field)
 
#define SIMPLEQ_INSERT_TAIL(head, elm, field)
 
#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field)
 
#define SIMPLEQ_REMOVE_HEAD(head, field)
 
#define SIMPLEQ_REMOVE_AFTER(head, elm, field)
 
#define SIMPLEQ_CONCAT(head1, head2)
 
#define XSIMPLEQ_HEAD(name, type)
 
#define XSIMPLEQ_ENTRY(type)
 
#define XSIMPLEQ_XOR(head, ptr)
 
#define XSIMPLEQ_FIRST(head)   XSIMPLEQ_XOR(head, ((head)->sqx_first))
 
#define XSIMPLEQ_END(head)   NULL
 
#define XSIMPLEQ_EMPTY(head)   (XSIMPLEQ_FIRST(head) == XSIMPLEQ_END(head))
 
#define XSIMPLEQ_NEXT(head, elm, field)   XSIMPLEQ_XOR(head, ((elm)->field.sqx_next))
 
#define XSIMPLEQ_FOREACH(var, head, field)
 
#define XSIMPLEQ_FOREACH_SAFE(var, head, field, tvar)
 
#define XSIMPLEQ_INIT(head)
 
#define XSIMPLEQ_INSERT_HEAD(head, elm, field)
 
#define XSIMPLEQ_INSERT_TAIL(head, elm, field)
 
#define XSIMPLEQ_INSERT_AFTER(head, listelm, elm, field)
 
#define XSIMPLEQ_REMOVE_HEAD(head, field)
 
#define XSIMPLEQ_REMOVE_AFTER(head, elm, field)
 
#define TAILQ_HEAD(name, type)
 
#define TAILQ_HEAD_INITIALIZER(head)   { NULL, &(head).tqh_first }
 
#define TAILQ_ENTRY(type)
 
#define TAILQ_FIRST(head)   ((head)->tqh_first)
 
#define TAILQ_END(head)   NULL
 
#define TAILQ_NEXT(elm, field)   ((elm)->field.tqe_next)
 
#define TAILQ_LAST(head, headname)   (*(((struct headname *)((head)->tqh_last))->tqh_last))
 
#define TAILQ_PREV(elm, headname, field)   (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 
#define TAILQ_EMPTY(head)   (TAILQ_FIRST(head) == TAILQ_END(head))
 
#define TAILQ_FOREACH(var, head, field)
 
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
 
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
 
#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)
 
#define TAILQ_INIT(head)
 
#define TAILQ_INSERT_HEAD(head, elm, field)
 
#define TAILQ_INSERT_TAIL(head, elm, field)
 
#define TAILQ_INSERT_AFTER(head, listelm, elm, field)
 
#define TAILQ_INSERT_BEFORE(listelm, elm, field)
 
#define TAILQ_REMOVE(head, elm, field)
 
#define TAILQ_REPLACE(head, elm, elm2, field)
 
#define TAILQ_CONCAT(head1, head2, field)
 

Detailed Description

Author
The Regents of the University of California
Date
1991, 1993

This file defines five types of data structures: singly-linked lists, lists, simple queues, tail queues and XOR simple queues.

A singly-linked list is headed by a single forward pointer. The elements are singly linked for minimum space and pointer manipulation overhead at the expense of O(n) removal for arbitrary elements. New elements can be added to the list after an existing element or at the head of the list. Elements being removed from the head of the list should use the explicit macro for this purpose for optimum efficiency. A singly-linked list may only be traversed in the forward direction. Singly-linked lists are ideal for applications with large datasets and few or no removals or for implementing a LIFO queue.

A list is headed by a single forward pointer (or an array of forward pointers for a hash table header). The elements are doubly linked so that an arbitrary element can be removed without a need to traverse the list. New elements can be added to the list before or after an existing element or at the head of the list. A list may only be traversed in the forward direction.

A simple queue is headed by a pair of pointers, one to the head of the list and the other to the tail of the list. The elements are singly linked to save space, so elements can only be removed from the head of the list. New elements can be added to the list before or after an existing element, at the head of the list, or at the end of the list. A simple queue may only be traversed in the forward direction.

A tail queue is headed by a pair of pointers, one to the head of the list and the other to the tail of the list. The elements are doubly linked so that an arbitrary element can be removed without a need to traverse the list. New elements can be added to the list before or after an existing element, at the head of the list, or at the end of the list. A tail queue may be traversed in either direction.

An XOR simple queue is used in the same way as a regular simple queue. The difference is that the head structure also includes a "cookie" that is XOR'd with the queue pointer (first, last or next) to generate the real pointer value.

For details on the use of these macros, see the queue(3) manual page.

Macro Definition Documentation

◆ LIST_ENTRY

#define LIST_ENTRY (   type)
Value:
struct { \
struct type *le_next; /* next element */ \
struct type **le_prev; /* address of previous next element */ \
}

◆ LIST_FOREACH

#define LIST_FOREACH (   var,
  head,
  field 
)
Value:
for((var) = LIST_FIRST(head); \
(var)!= LIST_END(head); \
(var) = LIST_NEXT(var, field))

◆ LIST_FOREACH_SAFE

#define LIST_FOREACH_SAFE (   var,
  head,
  field,
  tvar 
)
Value:
for ((var) = LIST_FIRST(head); \
(var) && ((tvar) = LIST_NEXT(var, field), 1); \
(var) = (tvar))

◆ LIST_HEAD

#define LIST_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *lh_first; /* first element */ \
}

◆ LIST_INIT

#define LIST_INIT (   head)
Value:
do { \
LIST_FIRST(head) = LIST_END(head); \
} while (0)

◆ LIST_INSERT_AFTER

#define LIST_INSERT_AFTER (   listelm,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
(listelm)->field.le_next->field.le_prev = \
&(elm)->field.le_next; \
(listelm)->field.le_next = (elm); \
(elm)->field.le_prev = &(listelm)->field.le_next; \
} while (0)

◆ LIST_INSERT_BEFORE

#define LIST_INSERT_BEFORE (   listelm,
  elm,
  field 
)
Value:
do { \
(elm)->field.le_prev = (listelm)->field.le_prev; \
(elm)->field.le_next = (listelm); \
*(listelm)->field.le_prev = (elm); \
(listelm)->field.le_prev = &(elm)->field.le_next; \
} while (0)

◆ LIST_INSERT_HEAD

#define LIST_INSERT_HEAD (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
(head)->lh_first = (elm); \
(elm)->field.le_prev = &(head)->lh_first; \
} while (0)

◆ LIST_REMOVE

#define LIST_REMOVE (   elm,
  field 
)
Value:
do { \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
(elm)->field.le_prev; \
*(elm)->field.le_prev = (elm)->field.le_next; \
_Q_INVALIDATE((elm)->field.le_prev); \
_Q_INVALIDATE((elm)->field.le_next); \
} while (0)

◆ LIST_REPLACE

#define LIST_REPLACE (   elm,
  elm2,
  field 
)
Value:
do { \
if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
(elm2)->field.le_next->field.le_prev = \
&(elm2)->field.le_next; \
(elm2)->field.le_prev = (elm)->field.le_prev; \
*(elm2)->field.le_prev = (elm2); \
_Q_INVALIDATE((elm)->field.le_prev); \
_Q_INVALIDATE((elm)->field.le_next); \
} while (0)

◆ SIMPLEQ_CONCAT

#define SIMPLEQ_CONCAT (   head1,
  head2 
)
Value:
do { \
if (!SIMPLEQ_EMPTY((head2))) { \
*(head1)->sqh_last = (head2)->sqh_first; \
(head1)->sqh_last = (head2)->sqh_last; \
SIMPLEQ_INIT((head2)); \
} \
} while (0)

◆ SIMPLEQ_ENTRY

#define SIMPLEQ_ENTRY (   type)
Value:
struct { \
struct type *sqe_next; /* next element */ \
}

◆ SIMPLEQ_FOREACH

#define SIMPLEQ_FOREACH (   var,
  head,
  field 
)
Value:
for((var) = SIMPLEQ_FIRST(head); \
(var) != SIMPLEQ_END(head); \
(var) = SIMPLEQ_NEXT(var, field))

◆ SIMPLEQ_FOREACH_SAFE

#define SIMPLEQ_FOREACH_SAFE (   var,
  head,
  field,
  tvar 
)
Value:
for ((var) = SIMPLEQ_FIRST(head); \
(var) && ((tvar) = SIMPLEQ_NEXT(var, field), 1); \
(var) = (tvar))

◆ SIMPLEQ_HEAD

#define SIMPLEQ_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *sqh_first; /* first element */ \
struct type **sqh_last; /* addr of last next element */ \
}

◆ SIMPLEQ_INIT

#define SIMPLEQ_INIT (   head)
Value:
do { \
(head)->sqh_first = NULL; \
(head)->sqh_last = &(head)->sqh_first; \
} while (0)

◆ SIMPLEQ_INSERT_AFTER

#define SIMPLEQ_INSERT_AFTER (   head,
  listelm,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
(head)->sqh_last = &(elm)->field.sqe_next; \
(listelm)->field.sqe_next = (elm); \
} while (0)

◆ SIMPLEQ_INSERT_HEAD

#define SIMPLEQ_INSERT_HEAD (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
(head)->sqh_first = (elm); \
} while (0)

◆ SIMPLEQ_INSERT_TAIL

#define SIMPLEQ_INSERT_TAIL (   head,
  elm,
  field 
)
Value:
do { \
(elm)->field.sqe_next = NULL; \
*(head)->sqh_last = (elm); \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (0)

◆ SIMPLEQ_REMOVE_AFTER

#define SIMPLEQ_REMOVE_AFTER (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \
== NULL) \
(head)->sqh_last = &(elm)->field.sqe_next; \
} while (0)

◆ SIMPLEQ_REMOVE_HEAD

#define SIMPLEQ_REMOVE_HEAD (   head,
  field 
)
Value:
do { \
if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
(head)->sqh_last = &(head)->sqh_first; \
} while (0)

◆ SLIST_ENTRY

#define SLIST_ENTRY (   type)
Value:
struct { \
struct type *sle_next; /* next element */ \
}

◆ SLIST_FOREACH

#define SLIST_FOREACH (   var,
  head,
  field 
)
Value:
for((var) = SLIST_FIRST(head); \
(var) != SLIST_END(head); \
(var) = SLIST_NEXT(var, field))

◆ SLIST_FOREACH_SAFE

#define SLIST_FOREACH_SAFE (   var,
  head,
  field,
  tvar 
)
Value:
for ((var) = SLIST_FIRST(head); \
(var) && ((tvar) = SLIST_NEXT(var, field), 1); \
(var) = (tvar))

◆ SLIST_HEAD

#define SLIST_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *slh_first; /* first element */ \
}

◆ SLIST_INIT

#define SLIST_INIT (   head)
Value:
{ \
SLIST_FIRST(head) = SLIST_END(head); \
}

◆ SLIST_INSERT_AFTER

#define SLIST_INSERT_AFTER (   slistelm,
  elm,
  field 
)
Value:
do { \
(elm)->field.sle_next = (slistelm)->field.sle_next; \
(slistelm)->field.sle_next = (elm); \
} while (0)

◆ SLIST_INSERT_HEAD

#define SLIST_INSERT_HEAD (   head,
  elm,
  field 
)
Value:
do { \
(elm)->field.sle_next = (head)->slh_first; \
(head)->slh_first = (elm); \
} while (0)

◆ SLIST_REMOVE

#define SLIST_REMOVE (   head,
  elm,
  type,
  field 
)
Value:
do { \
if ((head)->slh_first == (elm)) { \
SLIST_REMOVE_HEAD((head), field); \
} else { \
struct type *curelm = (head)->slh_first; \
\
while (curelm->field.sle_next != (elm)) \
curelm = curelm->field.sle_next; \
curelm->field.sle_next = \
curelm->field.sle_next->field.sle_next; \
} \
_Q_INVALIDATE((elm)->field.sle_next); \
} while (0)

◆ SLIST_REMOVE_AFTER

#define SLIST_REMOVE_AFTER (   elm,
  field 
)
Value:
do { \
(elm)->field.sle_next = (elm)->field.sle_next->field.sle_next; \
} while (0)

◆ SLIST_REMOVE_HEAD

#define SLIST_REMOVE_HEAD (   head,
  field 
)
Value:
do { \
(head)->slh_first = (head)->slh_first->field.sle_next; \
} while (0)

◆ TAILQ_CONCAT

#define TAILQ_CONCAT (   head1,
  head2,
  field 
)
Value:
do { \
if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \
} \
} while (0)

◆ TAILQ_ENTRY

#define TAILQ_ENTRY (   type)
Value:
struct { \
struct type *tqe_next; /* next element */ \
struct type **tqe_prev; /* address of previous next element */ \
}

◆ TAILQ_FOREACH

#define TAILQ_FOREACH (   var,
  head,
  field 
)
Value:
for((var) = TAILQ_FIRST(head); \
(var) != TAILQ_END(head); \
(var) = TAILQ_NEXT(var, field))

◆ TAILQ_FOREACH_REVERSE

#define TAILQ_FOREACH_REVERSE (   var,
  head,
  headname,
  field 
)
Value:
for((var) = TAILQ_LAST(head, headname); \
(var) != TAILQ_END(head); \
(var) = TAILQ_PREV(var, headname, field))

◆ TAILQ_FOREACH_REVERSE_SAFE

#define TAILQ_FOREACH_REVERSE_SAFE (   var,
  head,
  headname,
  field,
  tvar 
)
Value:
for ((var) = TAILQ_LAST(head, headname); \
(var) != TAILQ_END(head) && \
((tvar) = TAILQ_PREV(var, headname, field), 1); \
(var) = (tvar))

◆ TAILQ_FOREACH_SAFE

#define TAILQ_FOREACH_SAFE (   var,
  head,
  field,
  tvar 
)
Value:
for ((var) = TAILQ_FIRST(head); \
(var) != TAILQ_END(head) && \
((tvar) = TAILQ_NEXT(var, field), 1); \
(var) = (tvar))

◆ TAILQ_HEAD

#define TAILQ_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *tqh_first; /* first element */ \
struct type **tqh_last; /* addr of last next element */ \
}

◆ TAILQ_INIT

#define TAILQ_INIT (   head)
Value:
do { \
(head)->tqh_first = NULL; \
(head)->tqh_last = &(head)->tqh_first; \
} while (0)

◆ TAILQ_INSERT_AFTER

#define TAILQ_INSERT_AFTER (   head,
  listelm,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
(elm)->field.tqe_next->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(listelm)->field.tqe_next = (elm); \
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
} while (0)

◆ TAILQ_INSERT_BEFORE

#define TAILQ_INSERT_BEFORE (   listelm,
  elm,
  field 
)
Value:
do { \
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
(elm)->field.tqe_next = (listelm); \
*(listelm)->field.tqe_prev = (elm); \
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
} while (0)

◆ TAILQ_INSERT_HEAD

#define TAILQ_INSERT_HEAD (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
(head)->tqh_first->field.tqe_prev = \
&(elm)->field.tqe_next; \
else \
(head)->tqh_last = &(elm)->field.tqe_next; \
(head)->tqh_first = (elm); \
(elm)->field.tqe_prev = &(head)->tqh_first; \
} while (0)

◆ TAILQ_INSERT_TAIL

#define TAILQ_INSERT_TAIL (   head,
  elm,
  field 
)
Value:
do { \
(elm)->field.tqe_next = NULL; \
(elm)->field.tqe_prev = (head)->tqh_last; \
*(head)->tqh_last = (elm); \
(head)->tqh_last = &(elm)->field.tqe_next; \
} while (0)

◆ TAILQ_REMOVE

#define TAILQ_REMOVE (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.tqe_next) != NULL) \
(elm)->field.tqe_next->field.tqe_prev = \
(elm)->field.tqe_prev; \
else \
(head)->tqh_last = (elm)->field.tqe_prev; \
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
_Q_INVALIDATE((elm)->field.tqe_prev); \
_Q_INVALIDATE((elm)->field.tqe_next); \
} while (0)

◆ TAILQ_REPLACE

#define TAILQ_REPLACE (   head,
  elm,
  elm2,
  field 
)
Value:
do { \
if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
(elm2)->field.tqe_next->field.tqe_prev = \
&(elm2)->field.tqe_next; \
else \
(head)->tqh_last = &(elm2)->field.tqe_next; \
(elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
*(elm2)->field.tqe_prev = (elm2); \
_Q_INVALIDATE((elm)->field.tqe_prev); \
_Q_INVALIDATE((elm)->field.tqe_next); \
} while (0)

◆ XSIMPLEQ_ENTRY

#define XSIMPLEQ_ENTRY (   type)
Value:
struct { \
struct type *sqx_next; /* next element */ \
}

◆ XSIMPLEQ_FOREACH

#define XSIMPLEQ_FOREACH (   var,
  head,
  field 
)
Value:
for ((var) = XSIMPLEQ_FIRST(head); \
(var) != XSIMPLEQ_END(head); \
(var) = XSIMPLEQ_NEXT(head, var, field))

◆ XSIMPLEQ_FOREACH_SAFE

#define XSIMPLEQ_FOREACH_SAFE (   var,
  head,
  field,
  tvar 
)
Value:
for ((var) = XSIMPLEQ_FIRST(head); \
(var) && ((tvar) = XSIMPLEQ_NEXT(head, var, field), 1); \
(var) = (tvar))

◆ XSIMPLEQ_HEAD

#define XSIMPLEQ_HEAD (   name,
  type 
)
Value:
struct name { \
struct type *sqx_first; /* first element */ \
struct type **sqx_last; /* addr of last next element */ \
unsigned long sqx_cookie; \
}

◆ XSIMPLEQ_INIT

#define XSIMPLEQ_INIT (   head)
Value:
do { \
arc4random_buf(&(head)->sqx_cookie, sizeof((head)->sqx_cookie)); \
(head)->sqx_first = XSIMPLEQ_XOR(head, NULL); \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
} while (0)

◆ XSIMPLEQ_INSERT_AFTER

#define XSIMPLEQ_INSERT_AFTER (   head,
  listelm,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.sqx_next = (listelm)->field.sqx_next) == \
XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
(listelm)->field.sqx_next = XSIMPLEQ_XOR(head, (elm)); \
} while (0)

◆ XSIMPLEQ_INSERT_HEAD

#define XSIMPLEQ_INSERT_HEAD (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.sqx_next = (head)->sqx_first) == \
XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
(head)->sqx_first = XSIMPLEQ_XOR(head, (elm)); \
} while (0)

◆ XSIMPLEQ_INSERT_TAIL

#define XSIMPLEQ_INSERT_TAIL (   head,
  elm,
  field 
)
Value:
do { \
(elm)->field.sqx_next = XSIMPLEQ_XOR(head, NULL); \
*(XSIMPLEQ_XOR(head, (head)->sqx_last)) = XSIMPLEQ_XOR(head, (elm)); \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
} while (0)

◆ XSIMPLEQ_REMOVE_AFTER

#define XSIMPLEQ_REMOVE_AFTER (   head,
  elm,
  field 
)
Value:
do { \
if (((elm)->field.sqx_next = XSIMPLEQ_XOR(head, \
(elm)->field.sqx_next)->field.sqx_next) \
== XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = \
XSIMPLEQ_XOR(head, &(elm)->field.sqx_next); \
} while (0)

◆ XSIMPLEQ_REMOVE_HEAD

#define XSIMPLEQ_REMOVE_HEAD (   head,
  field 
)
Value:
do { \
if (((head)->sqx_first = XSIMPLEQ_XOR(head, \
(head)->sqx_first)->field.sqx_next) == XSIMPLEQ_XOR(head, NULL)) \
(head)->sqx_last = XSIMPLEQ_XOR(head, &(head)->sqx_first); \
} while (0)

◆ XSIMPLEQ_XOR

#define XSIMPLEQ_XOR (   head,
  ptr 
)
Value:
((__typeof(ptr))((head)->sqx_cookie ^ \
(unsigned long)(ptr)))