PX4 Firmware
PX4 Autopilot Software http://px4.io
utlist.h File Reference
#include <assert.h>
Include dependency graph for utlist.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UTLIST_VERSION   1.9.6
 
#define LDECLTYPE(x)   __typeof(x)
 
#define _SV(elt, list)
 
#define _NEXT(elt, list)   ((elt)->next)
 
#define _NEXTASGN(elt, list, to)   ((elt)->next)=(to)
 
#define _PREV(elt, list)   ((elt)->prev)
 
#define _PREVASGN(elt, list, to)   ((elt)->prev)=(to)
 
#define _RS(list)
 
#define _CASTASGN(a, b)   (a)=(b)
 
#define LL_SORT(list, cmp)
 
#define DL_SORT(list, cmp)
 
#define CDL_SORT(list, cmp)
 
#define LL_PREPEND(head, add)
 
#define LL_CONCAT(head1, head2)
 
#define LL_APPEND(head, add)
 
#define LL_DELETE(head, del)
 
#define LL_APPEND_VS2008(head, add)
 
#define LL_DELETE_VS2008(head, del)
 
#define LL_FOREACH(head, el)   for(el=head;el;el=(el)->next)
 
#define LL_FOREACH_SAFE(head, el, tmp)   for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
 
#define LL_SEARCH_SCALAR(head, out, field, val)
 
#define LL_SEARCH(head, out, elt, cmp)
 
#define DL_PREPEND(head, add)
 
#define DL_APPEND(head, add)
 
#define DL_CONCAT(head1, head2)
 
#define DL_DELETE(head, del)
 
#define DL_FOREACH(head, el)   for(el=head;el;el=(el)->next)
 
#define DL_FOREACH_SAFE(head, el, tmp)   for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)
 
#define DL_SEARCH_SCALAR   LL_SEARCH_SCALAR
 
#define DL_SEARCH   LL_SEARCH
 
#define CDL_PREPEND(head, add)
 
#define CDL_DELETE(head, del)
 
#define CDL_FOREACH(head, el)   for(el=head;el;el=((el)->next==head ? 0L : (el)->next))
 
#define CDL_FOREACH_SAFE(head, el, tmp1, tmp2)
 
#define CDL_SEARCH_SCALAR(head, out, field, val)
 
#define CDL_SEARCH(head, out, elt, cmp)
 

Macro Definition Documentation

◆ _CASTASGN

#define _CASTASGN (   a,
 
)    (a)=(b)

Definition at line 95 of file utlist.h.

◆ _NEXT

#define _NEXT (   elt,
  list 
)    ((elt)->next)

Definition at line 90 of file utlist.h.

◆ _NEXTASGN

#define _NEXTASGN (   elt,
  list,
  to 
)    ((elt)->next)=(to)

Definition at line 91 of file utlist.h.

◆ _PREV

#define _PREV (   elt,
  list 
)    ((elt)->prev)

Definition at line 92 of file utlist.h.

◆ _PREVASGN

#define _PREVASGN (   elt,
  list,
  to 
)    ((elt)->prev)=(to)

Definition at line 93 of file utlist.h.

◆ _RS

#define _RS (   list)

Definition at line 94 of file utlist.h.

◆ _SV

#define _SV (   elt,
  list 
)

Definition at line 89 of file utlist.h.

◆ CDL_DELETE

#define CDL_DELETE (   head,
  del 
)
Value:
do { \
if ( ((head)==(del)) && ((head)->next == (head))) { \
(head) = 0L; \
} else { \
(del)->next->prev = (del)->prev; \
(del)->prev->next = (del)->next; \
if ((del) == (head)) (head)=(del)->next; \
} \
} while (0)

Definition at line 488 of file utlist.h.

◆ CDL_FOREACH

#define CDL_FOREACH (   head,
  el 
)    for(el=head;el;el=((el)->next==head ? 0L : (el)->next))

Definition at line 499 of file utlist.h.

◆ CDL_FOREACH_SAFE

#define CDL_FOREACH_SAFE (   head,
  el,
  tmp1,
  tmp2 
)
Value:
for((el)=(head), ((tmp1)=(head)?((head)->prev):NULL); \
(el) && ((tmp2)=(el)->next, 1); \
((el) = (((el)==(tmp1)) ? 0L : (tmp2))))

Definition at line 502 of file utlist.h.

◆ CDL_PREPEND

#define CDL_PREPEND (   head,
  add 
)
Value:
do { \
if (head) { \
(add)->prev = (head)->prev; \
(add)->next = (head); \
(head)->prev = (add); \
(add)->prev->next = (add); \
} else { \
(add)->prev = (add); \
(add)->next = (add); \
} \
(head)=(add); \
} while (0)

Definition at line 474 of file utlist.h.

◆ CDL_SEARCH

#define CDL_SEARCH (   head,
  out,
  elt,
  cmp 
)
Value:
do { \
CDL_FOREACH(head,out) { \
if ((cmp(out,elt))==0) break; \
} \
} while(0)

Definition at line 514 of file utlist.h.

◆ CDL_SEARCH_SCALAR

#define CDL_SEARCH_SCALAR (   head,
  out,
  field,
  val 
)
Value:
do { \
CDL_FOREACH(head,out) { \
if ((out)->field == (val)) break; \
} \
} while(0)

Definition at line 507 of file utlist.h.

◆ CDL_SORT

#define CDL_SORT (   list,
  cmp 
)

Definition at line 216 of file utlist.h.

◆ DL_APPEND

#define DL_APPEND (   head,
  add 
)
Value:
do { \
if (head) { \
(add)->prev = (head)->prev; \
(head)->prev->next = (add); \
(head)->prev = (add); \
(add)->next = NULL; \
} else { \
(head)=(add); \
(head)->prev = (head); \
(head)->next = NULL; \
} \
} while (0)

Definition at line 412 of file utlist.h.

◆ DL_CONCAT

#define DL_CONCAT (   head1,
  head2 
)
Value:
do { \
LDECLTYPE(head1) _tmp; \
if (head2) { \
if (head1) { \
_tmp = (head2)->prev; \
(head2)->prev = (head1)->prev; \
(head1)->prev->next = (head2); \
(head1)->prev = _tmp; \
} else { \
(head1)=(head2); \
} \
} \
} while (0)

Definition at line 426 of file utlist.h.

◆ DL_DELETE

#define DL_DELETE (   head,
  del 
)
Value:
do { \
assert((del)->prev != NULL); \
if ((del)->prev == (del)) { \
(head)=NULL; \
} else if ((del)==(head)) { \
(del)->next->prev = (del)->prev; \
(head) = (del)->next; \
} else { \
(del)->prev->next = (del)->next; \
if ((del)->next) { \
(del)->next->prev = (del)->prev; \
} else { \
(head)->prev = (del)->prev; \
} \
} \
} while (0)

Definition at line 441 of file utlist.h.

◆ DL_FOREACH

#define DL_FOREACH (   head,
  el 
)    for(el=head;el;el=(el)->next)

Definition at line 460 of file utlist.h.

◆ DL_FOREACH_SAFE

#define DL_FOREACH_SAFE (   head,
  el,
  tmp 
)    for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)

Definition at line 464 of file utlist.h.

◆ DL_PREPEND

#define DL_PREPEND (   head,
  add 
)
Value:
do { \
(add)->next = head; \
if (head) { \
(add)->prev = (head)->prev; \
(head)->prev = (add); \
} else { \
(add)->prev = (add); \
} \
(head) = (add); \
} while (0)

Definition at line 400 of file utlist.h.

◆ DL_SEARCH

#define DL_SEARCH   LL_SEARCH

Definition at line 469 of file utlist.h.

◆ DL_SEARCH_SCALAR

#define DL_SEARCH_SCALAR   LL_SEARCH_SCALAR

Definition at line 468 of file utlist.h.

◆ DL_SORT

#define DL_SORT (   list,
  cmp 
)

Definition at line 158 of file utlist.h.

◆ LDECLTYPE

#define LDECLTYPE (   x)    __typeof(x)

Definition at line 74 of file utlist.h.

◆ LL_APPEND

#define LL_APPEND (   head,
  add 
)
Value:
do { \
LDECLTYPE(head) _tmp; \
(add)->next=NULL; \
if (head) { \
_tmp = head; \
while (_tmp->next) { _tmp = _tmp->next; } \
_tmp->next=(add); \
} else { \
(head)=(add); \
} \
} while (0)

Definition at line 307 of file utlist.h.

Referenced by Mavlink::task_main().

◆ LL_APPEND_VS2008

#define LL_APPEND_VS2008 (   head,
  add 
)
Value:
do { \
if (head) { \
(add)->next = head; /* use add->next as a temp variable */ \
while ((add)->next->next) { (add)->next = (add)->next->next; } \
(add)->next->next=(add); \
} else { \
(head)=(add); \
} \
(add)->next=NULL; \
} while (0)

Definition at line 337 of file utlist.h.

◆ LL_CONCAT

#define LL_CONCAT (   head1,
  head2 
)
Value:
do { \
LDECLTYPE(head1) _tmp; \
if (head1) { \
_tmp = head1; \
while (_tmp->next) { _tmp = _tmp->next; } \
_tmp->next=(head2); \
} else { \
(head1)=(head2); \
} \
} while (0)

Definition at line 295 of file utlist.h.

◆ LL_DELETE

#define LL_DELETE (   head,
  del 
)
Value:
do { \
LDECLTYPE(head) _tmp; \
if ((head) == (del)) { \
(head)=(head)->next; \
} else { \
_tmp = head; \
while (_tmp->next && (_tmp->next != (del))) { \
_tmp = _tmp->next; \
} \
if (_tmp->next) { \
_tmp->next = ((del)->next); \
} \
} \
} while (0)

Definition at line 320 of file utlist.h.

Referenced by Mavlink::destroy_all_instances().

◆ LL_DELETE_VS2008

#define LL_DELETE_VS2008 (   head,
  del 
)
Value:
do { \
if ((head) == (del)) { \
(head)=(head)->next; \
} else { \
char *_tmp = (char*)(head); \
while ((head)->next && ((head)->next != (del))) { \
head = (head)->next; \
} \
if ((head)->next) { \
(head)->next = ((del)->next); \
} \
{ \
char **_head_alias = (char**)&(head); \
*_head_alias = _tmp; \
} \
} \
} while (0)

Definition at line 349 of file utlist.h.

◆ LL_FOREACH

#define LL_FOREACH (   head,
  el 
)    for(el=head;el;el=(el)->next)

◆ LL_FOREACH_SAFE

#define LL_FOREACH_SAFE (   head,
  el,
  tmp 
)    for((el)=(head);(el) && (tmp = (el)->next, 1); (el) = tmp)

Definition at line 380 of file utlist.h.

◆ LL_PREPEND

#define LL_PREPEND (   head,
  add 
)
Value:
do { \
(add)->next = head; \
head = add; \
} while (0)

Definition at line 289 of file utlist.h.

◆ LL_SEARCH

#define LL_SEARCH (   head,
  out,
  elt,
  cmp 
)
Value:
do { \
LL_FOREACH(head,out) { \
if ((cmp(out,elt))==0) break; \
} \
} while(0)

Definition at line 390 of file utlist.h.

◆ LL_SEARCH_SCALAR

#define LL_SEARCH_SCALAR (   head,
  out,
  field,
  val 
)
Value:
do { \
LL_FOREACH(head,out) { \
if ((out)->field == (val)) break; \
} \
} while(0)

Definition at line 383 of file utlist.h.

◆ LL_SORT

#define LL_SORT (   list,
  cmp 
)

Definition at line 102 of file utlist.h.

◆ UTLIST_VERSION

#define UTLIST_VERSION   1.9.6

Definition at line 27 of file utlist.h.