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 2.0.2
#define | LDECLTYPE(x) __typeof(x)
#define | IF_NO_DECLTYPE(x)
#define | UTLIST_SV(elt, list)
#define | UTLIST_NEXT(elt, list, next) ((elt)->next)
#define | UTLIST_NEXTASGN(elt, list, to, next) ((elt)->next)=(to)
#define | UTLIST_PREVASGN(elt, list, to, prev) ((elt)->prev)=(to)
#define | UTLIST_RS(list)
#define | UTLIST_CASTASGN(a, b) (a)=(b)
#define | LL_SORT(list, cmp) LL_SORT2(list, cmp, next)
#define | LL_SORT2(list, cmp, next)
#define | DL_SORT(list, cmp) DL_SORT2(list, cmp, prev, next)
#define | DL_SORT2(list, cmp, prev, next)
#define | CDL_SORT(list, cmp) CDL_SORT2(list, cmp, prev, next)
#define | CDL_SORT2(list, cmp, prev, next)
#define | LL_PREPEND(head, add) LL_PREPEND2(head,add,next)
#define | LL_PREPEND2(head, add, next)
#define | LL_CONCAT(head1, head2) LL_CONCAT2(head1,head2,next)
#define | LL_CONCAT2(head1, head2, next)
#define | LL_APPEND(head, add) LL_APPEND2(head,add,next)
#define | LL_APPEND2(head, add, next)
#define | LL_INSERT_INORDER(head, add, cmp) LL_INSERT_INORDER2(head,add,cmp,next)
#define | LL_INSERT_INORDER2(head, add, cmp, next)
#define | LL_LOWER_BOUND(head, elt, like, cmp) LL_LOWER_BOUND2(head,elt,like,cmp,next)
#define | LL_LOWER_BOUND2(head, elt, like, cmp, next)
#define | LL_DELETE(head, del) LL_DELETE2(head,del,next)
#define | LL_DELETE2(head, del, next)
#define | LL_COUNT(head, el, counter) LL_COUNT2(head,el,counter,next) \
#define | LL_COUNT2(head, el, counter, next)
#define | LL_FOREACH(head, el) LL_FOREACH2(head,el,next)
#define | LL_FOREACH2(head, el, next) for ((el) = (head); el; (el) = (el)->next)
#define | LL_FOREACH_SAFE(head, el, tmp) LL_FOREACH_SAFE2(head,el,tmp,next)
#define | LL_FOREACH_SAFE2(head, el, tmp, next) for ((el) = (head); (el) && ((tmp) = (el)->next, 1); (el) = (tmp))
#define | LL_SEARCH_SCALAR(head, out, field, val) LL_SEARCH_SCALAR2(head,out,field,val,next)
#define | LL_SEARCH_SCALAR2(head, out, field, val, next)
#define | LL_SEARCH(head, out, elt, cmp) LL_SEARCH2(head,out,elt,cmp,next)
#define | LL_SEARCH2(head, out, elt, cmp, next)
#define | LL_REPLACE_ELEM2(head, el, add, next)
#define | LL_REPLACE_ELEM(head, el, add) LL_REPLACE_ELEM2(head, el, add, next)
#define | LL_PREPEND_ELEM2(head, el, add, next)
#define | LL_PREPEND_ELEM(head, el, add) LL_PREPEND_ELEM2(head, el, add, next)
#define | LL_APPEND_ELEM2(head, el, add, next)
#define | LL_APPEND_ELEM(head, el, add) LL_APPEND_ELEM2(head, el, add, next)
#define | DL_PREPEND(head, add) DL_PREPEND2(head,add,prev,next)
#define | DL_PREPEND2(head, add, prev, next)
#define | DL_APPEND(head, add) DL_APPEND2(head,add,prev,next)
#define | DL_APPEND2(head, add, prev, next)
#define | DL_INSERT_INORDER(head, add, cmp) DL_INSERT_INORDER2(head,add,cmp,next)
#define | DL_INSERT_INORDER2(head, add, cmp, next)
#define | DL_LOWER_BOUND(head, elt, like, cmp) DL_LOWER_BOUND2(head,elt,like,cmp,next)
#define | DL_LOWER_BOUND2(head, elt, like, cmp, next)
#define | DL_CONCAT(head1, head2) DL_CONCAT2(head1,head2,prev,next)
#define | DL_CONCAT2(head1, head2, prev, next)
#define | DL_DELETE(head, del) DL_DELETE2(head,del,prev,next)
#define | DL_DELETE2(head, del, prev, next)
#define | DL_COUNT(head, el, counter) DL_COUNT2(head,el,counter,next) \
#define | DL_COUNT2(head, el, counter, next)
#define | DL_FOREACH(head, el) DL_FOREACH2(head,el,next)
#define | DL_FOREACH2(head, el, next) for ((el) = (head); el; (el) = (el)->next)
#define | DL_FOREACH_SAFE(head, el, tmp) DL_FOREACH_SAFE2(head,el,tmp,next)
#define | DL_FOREACH_SAFE2(head, el, tmp, next) for ((el) = (head); (el) && ((tmp) = (el)->next, 1); (el) = (tmp))
#define | DL_SEARCH_SCALAR LL_SEARCH_SCALAR
#define | DL_SEARCH LL_SEARCH
#define | DL_SEARCH_SCALAR2 LL_SEARCH_SCALAR2
#define | DL_SEARCH2 LL_SEARCH2
#define | DL_REPLACE_ELEM2(head, el, add, prev, next)
#define | DL_REPLACE_ELEM(head, el, add) DL_REPLACE_ELEM2(head, el, add, prev, next)
#define | DL_PREPEND_ELEM2(head, el, add, prev, next)
#define | DL_PREPEND_ELEM(head, el, add) DL_PREPEND_ELEM2(head, el, add, prev, next)
#define | DL_APPEND_ELEM2(head, el, add, prev, next)
#define | DL_APPEND_ELEM(head, el, add) DL_APPEND_ELEM2(head, el, add, prev, next)
#define | CDL_APPEND(head, add) CDL_APPEND2(head,add,prev,next)
#define | CDL_APPEND2(head, add, prev, next)
#define | CDL_PREPEND(head, add) CDL_PREPEND2(head,add,prev,next)
#define | CDL_PREPEND2(head, add, prev, next)
#define | CDL_INSERT_INORDER(head, add, cmp) CDL_INSERT_INORDER2(head,add,cmp,next)
#define | CDL_INSERT_INORDER2(head, add, cmp, next)
#define | CDL_LOWER_BOUND(head, elt, like, cmp) CDL_LOWER_BOUND2(head,elt,like,cmp,next)
#define | CDL_LOWER_BOUND2(head, elt, like, cmp, next)
#define | CDL_DELETE(head, del) CDL_DELETE2(head,del,prev,next)
#define | CDL_DELETE2(head, del, prev, next)
#define | CDL_COUNT(head, el, counter) CDL_COUNT2(head,el,counter,next) \
#define | CDL_COUNT2(head, el, counter, next)
#define | CDL_FOREACH(head, el) CDL_FOREACH2(head,el,next)
#define | CDL_FOREACH2(head, el, next) for ((el)=(head);el;(el)=(((el)->next==(head)) ? NULL : (el)->next))
#define | CDL_FOREACH_SAFE(head, el, tmp1, tmp2) CDL_FOREACH_SAFE2(head,el,tmp1,tmp2,prev,next)
#define | CDL_FOREACH_SAFE2(head, el, tmp1, tmp2, prev, next)
#define | CDL_SEARCH_SCALAR(head, out, field, val) CDL_SEARCH_SCALAR2(head,out,field,val,next)
#define | CDL_SEARCH_SCALAR2(head, out, field, val, next)
#define | CDL_SEARCH(head, out, elt, cmp) CDL_SEARCH2(head,out,elt,cmp,next)
#define | CDL_SEARCH2(head, out, elt, cmp, next)
#define | CDL_REPLACE_ELEM2(head, el, add, prev, next)
#define | CDL_REPLACE_ELEM(head, el, add) CDL_REPLACE_ELEM2(head, el, add, prev, next)
#define | CDL_PREPEND_ELEM2(head, el, add, prev, next)
#define | CDL_PREPEND_ELEM(head, el, add) CDL_PREPEND_ELEM2(head, el, add, prev, next)
#define | CDL_APPEND_ELEM2(head, el, add, prev, next)
#define | CDL_APPEND_ELEM(head, el, add) CDL_APPEND_ELEM2(head, el, add, prev, next)

## Macro Definition Documentation

## CDL_APPEND

#define CDL_APPEND | ( |  | head,
|  |  | add
| ) |  | CDL_APPEND2(head,add,prev,next)

Definition at line 860 of file utlist.h.

## CDL_APPEND2

#define CDL_APPEND2 | ( |  | head,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

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 863 of file utlist.h.

## CDL_APPEND_ELEM

#define CDL_APPEND_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | CDL_APPEND_ELEM2(head, el, add, prev, next)

Definition at line 1040 of file utlist.h.

## CDL_APPEND_ELEM2

#define CDL_APPEND_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \
(add)->prev = (el); \
(el)->next = (add); \
(add)->next->prev = (add); \
} else { \
CDL_PREPEND2(head, add, prev, next); \
} \
} while (0)

Definition at line 1026 of file utlist.h.

## CDL_COUNT

#define CDL_COUNT | ( |  | head,
|  |  | el,
|  |  | counter
| ) |  | CDL_COUNT2(head,el,counter,next) \

Definition at line 940 of file utlist.h.

## CDL_COUNT2

#define CDL_COUNT2 | ( |  | head,
|  |  | el,
|  |  | counter,
|  |  | next
| ) |  |

Value:
do { \
(counter) = 0; \
CDL_FOREACH2(head,el,next) { ++(counter); } \
} while (0)

Definition at line 943 of file utlist.h.

## CDL_DELETE

#define CDL_DELETE | ( |  | head,
|  |  | del
| ) |  | CDL_DELETE2(head,del,prev,next)

Definition at line 926 of file utlist.h.

## CDL_DELETE2

#define CDL_DELETE2 | ( |  | head,
|  |  | del,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
if (((head)==(del)) && ((head)->next == (head))) { \
(head) = NULL; \
} else { \
(del)->next->prev = (del)->prev; \
(del)->prev->next = (del)->next; \
if ((del) == (head)) (head)=(del)->next; \
} \
} while (0)

Definition at line 929 of file utlist.h.

## CDL_FOREACH

#define CDL_FOREACH | ( |  | head,
|  |  | el
| ) |  | CDL_FOREACH2(head,el,next)

Definition at line 949 of file utlist.h.

## CDL_FOREACH2

#define CDL_FOREACH2 | ( |  | head,
|  |  | el,
|  |  | next
| ) |  | for ((el)=(head);el;(el)=(((el)->next==(head)) ? NULL : (el)->next))

Definition at line 952 of file utlist.h.

## CDL_FOREACH_SAFE

#define CDL_FOREACH_SAFE | ( |  | head,
|  |  | el,
|  |  | tmp1,
|  |  | tmp2
| ) |  | CDL_FOREACH_SAFE2(head,el,tmp1,tmp2,prev,next)

Definition at line 955 of file utlist.h.

## CDL_FOREACH_SAFE2

#define CDL_FOREACH_SAFE2 | ( |  | head,
|  |  | el,
|  |  | tmp1,
|  |  | tmp2,
|  |  | prev,
|  |  | next
| ) |  |

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

Definition at line 958 of file utlist.h.

## CDL_INSERT_INORDER

#define CDL_INSERT_INORDER | ( |  | head,
|  |  | add,
|  |  | cmp
| ) |  | CDL_INSERT_INORDER2(head,add,cmp,next)

Definition at line 894 of file utlist.h.

## CDL_INSERT_INORDER2

#define CDL_INSERT_INORDER2 | ( |  | head,
|  |  | add,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
LDECLTYPE(head) _tmp; \
if (head) { \
CDL_LOWER_BOUND(head, _tmp, add, cmp); \
CDL_APPEND_ELEM(head, _tmp, add); \
} else { \
(head) = (add); \
(head)->next = (head); \
(head)->prev = (head); \
} \
} while (0)

Definition at line 897 of file utlist.h.

## CDL_LOWER_BOUND

#define CDL_LOWER_BOUND | ( |  | head,
|  |  | elt,
|  |  | like,
|  |  | cmp
| ) |  | CDL_LOWER_BOUND2(head,elt,like,cmp,next)

Definition at line 910 of file utlist.h.

## CDL_LOWER_BOUND2

#define CDL_LOWER_BOUND2 | ( |  | head,
|  |  | elt,
|  |  | like,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
if ((head) == NULL || (cmp(head, like)) >= 0) { \
(elt) = NULL; \
} else { \
for ((elt) = (head); (elt)->next != (head); (elt) = (elt)->next) { \
if ((cmp((elt)->next, like)) >= 0) { \
break; \
} \
} \
} \
} while (0)

Definition at line 913 of file utlist.h.

## CDL_PREPEND

#define CDL_PREPEND | ( |  | head,
|  |  | add
| ) |  | CDL_PREPEND2(head,add,prev,next)

Definition at line 877 of file utlist.h.

## CDL_PREPEND2

#define CDL_PREPEND2 | ( |  | head,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

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 880 of file utlist.h.

## CDL_PREPEND_ELEM

#define CDL_PREPEND_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | CDL_PREPEND_ELEM2(head, el, add, prev, next)

Definition at line 1023 of file utlist.h.

## CDL_PREPEND_ELEM2

#define CDL_PREPEND_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el); \
(add)->prev = (el)->prev; \
(el)->prev = (add); \
(add)->prev->next = (add); \
if ((head) == (el)) { \
(head) = (add); \
} \
} else { \
CDL_APPEND2(head, add, prev, next); \
} \
} while (0)

Definition at line 1006 of file utlist.h.

## CDL_REPLACE_ELEM

#define CDL_REPLACE_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | CDL_REPLACE_ELEM2(head, el, add, prev, next)

Definition at line 1003 of file utlist.h.

## CDL_REPLACE_ELEM2

#define CDL_REPLACE_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
if ((el)->next == (el)) { \
(add)->next = (add); \
(add)->prev = (add); \
(head) = (add); \
} else { \
(add)->next = (el)->next; \
(add)->prev = (el)->prev; \
(add)->next->prev = (add); \
(add)->prev->next = (add); \
if ((head) == (el)) { \
(head) = (add); \
} \
} \
} while (0)

Definition at line 983 of file utlist.h.

## CDL_SEARCH

#define CDL_SEARCH | ( |  | head,
|  |  | out,
|  |  | elt,
|  |  | cmp
| ) |  | CDL_SEARCH2(head,out,elt,cmp,next)

Definition at line 973 of file utlist.h.

## CDL_SEARCH2

#define CDL_SEARCH2 | ( |  | head,
|  |  | out,
|  |  | elt,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
CDL_FOREACH2(head,out,next) { \
if ((cmp(out,elt))==0) break; \
} \
} while (0)

Definition at line 976 of file utlist.h.

## CDL_SEARCH_SCALAR

#define CDL_SEARCH_SCALAR | ( |  | head,
|  |  | out,
|  |  | field,
|  |  | val
| ) |  | CDL_SEARCH_SCALAR2(head,out,field,val,next)

Definition at line 963 of file utlist.h.

## CDL_SEARCH_SCALAR2

#define CDL_SEARCH_SCALAR2 | ( |  | head,
|  |  | out,
|  |  | field,
|  |  | val,
|  |  | next
| ) |  |

Value:
do { \
CDL_FOREACH2(head,out,next) { \
if ((out)->field == (val)) break; \
} \
} while (0)

Definition at line 966 of file utlist.h.

## CDL_SORT

#define CDL_SORT | ( |  | list,
|  |  | cmp
| ) |  | CDL_SORT2(list, cmp, prev, next)

Definition at line 235 of file utlist.h.

## CDL_SORT2

#define CDL_SORT2 | ( |  | list,
|  |  | cmp,
|  |  | prev,
|  |  | next
| ) |  |

Definition at line 238 of file utlist.h.

## DL_APPEND

#define DL_APPEND | ( |  | head,
|  |  | add
| ) |  | DL_APPEND2(head,add,prev,next)

Definition at line 636 of file utlist.h.

## DL_APPEND2

#define DL_APPEND2 | ( |  | head,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

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 639 of file utlist.h.

## DL_APPEND_ELEM

#define DL_APPEND_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | DL_APPEND_ELEM2(head, el, add, prev, next)

Definition at line 821 of file utlist.h.

## DL_APPEND_ELEM2

#define DL_APPEND_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \
(add)->prev = (el); \
(el)->next = (add); \
if ((add)->next) { \
(add)->next->prev = (add); \
} else { \
(head)->prev = (add); \
} \
} else { \
DL_PREPEND2(head, add, prev, next); \
} \
} while (0) \

Definition at line 803 of file utlist.h.

## DL_CONCAT

#define DL_CONCAT | ( |  | head1,
|  |  | head2
| ) |  | DL_CONCAT2(head1,head2,prev,next)

Definition at line 685 of file utlist.h.

## DL_CONCAT2

#define DL_CONCAT2 | ( |  | head1,
|  |  | head2,
|  |  | prev,
|  |  | next
| ) |  |

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

Definition at line 688 of file utlist.h.

## DL_COUNT

#define DL_COUNT | ( |  | head,
|  |  | el,
|  |  | counter
| ) |  | DL_COUNT2(head,el,counter,next) \

Definition at line 725 of file utlist.h.

## DL_COUNT2

#define DL_COUNT2 | ( |  | head,
|  |  | el,
|  |  | counter,
|  |  | next
| ) |  |

Value:
do { \
(counter) = 0; \
DL_FOREACH2(head,el,next) { ++(counter); } \
} while (0)

Definition at line 728 of file utlist.h.

## DL_DELETE

#define DL_DELETE | ( |  | head,
|  |  | del
| ) |  | DL_DELETE2(head,del,prev,next)

Definition at line 703 of file utlist.h.

## DL_DELETE2

#define DL_DELETE2 | ( |  | head,
|  |  | del,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
assert((head) != NULL); \
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 706 of file utlist.h.

## DL_FOREACH

#define DL_FOREACH | ( |  | head,
|  |  | el
| ) |  | DL_FOREACH2(head,el,next)

Definition at line 734 of file utlist.h.

## DL_FOREACH2

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

Definition at line 737 of file utlist.h.

## DL_FOREACH_SAFE

#define DL_FOREACH_SAFE | ( |  | head,
|  |  | el,
|  |  | tmp
| ) |  | DL_FOREACH_SAFE2(head,el,tmp,next)

Definition at line 741 of file utlist.h.

## DL_FOREACH_SAFE2

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

Definition at line 744 of file utlist.h.

## DL_INSERT_INORDER

#define DL_INSERT_INORDER | ( |  | head,
|  |  | add,
|  |  | cmp
| ) |  | DL_INSERT_INORDER2(head,add,cmp,next)

Definition at line 653 of file utlist.h.

## DL_INSERT_INORDER2

#define DL_INSERT_INORDER2 | ( |  | head,
|  |  | add,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
LDECLTYPE(head) _tmp; \
if (head) { \
DL_LOWER_BOUND(head, _tmp, add, cmp); \
DL_APPEND_ELEM(head, _tmp, add); \
} else { \
(head) = (add); \
(head)->prev = (head); \
(head)->next = NULL; \
} \
} while (0)

Definition at line 656 of file utlist.h.

## DL_LOWER_BOUND

#define DL_LOWER_BOUND | ( |  | head,
|  |  | elt,
|  |  | like,
|  |  | cmp
| ) |  | DL_LOWER_BOUND2(head,elt,like,cmp,next)

Definition at line 669 of file utlist.h.

## DL_LOWER_BOUND2

#define DL_LOWER_BOUND2 | ( |  | head,
|  |  | elt,
|  |  | like,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
if ((head) == NULL || (cmp(head, like)) >= 0) { \
(elt) = NULL; \
} else { \
for ((elt) = (head); (elt)->next != NULL; (elt) = (elt)->next) { \
if ((cmp((elt)->next, like)) >= 0) { \
break; \
} \
} \
} \
} while (0)

Definition at line 672 of file utlist.h.

## DL_PREPEND

#define DL_PREPEND | ( |  | head,
|  |  | add
| ) |  | DL_PREPEND2(head,add,prev,next)

Definition at line 621 of file utlist.h.

## DL_PREPEND2

#define DL_PREPEND2 | ( |  | head,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

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 624 of file utlist.h.

## DL_PREPEND_ELEM

#define DL_PREPEND_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | DL_PREPEND_ELEM2(head, el, add, prev, next)

Definition at line 800 of file utlist.h.

## DL_PREPEND_ELEM2

#define DL_PREPEND_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el); \
(add)->prev = (el)->prev; \
(el)->prev = (add); \
if ((head) == (el)) { \
(head) = (add); \
} else { \
(add)->prev->next = (add); \
} \
} else { \
DL_APPEND2(head, add, prev, next); \
} \
} while (0) \

Definition at line 782 of file utlist.h.

## DL_REPLACE_ELEM

#define DL_REPLACE_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | DL_REPLACE_ELEM2(head, el, add, prev, next)

Definition at line 779 of file utlist.h.

## DL_REPLACE_ELEM2

#define DL_REPLACE_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | prev,
|  |  | next
| ) |  |

Value:
do { \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
if ((head) == (el)) { \
(head) = (add); \
(add)->next = (el)->next; \
if ((el)->next == NULL) { \
(add)->prev = (add); \
} else { \
(add)->prev = (el)->prev; \
(add)->next->prev = (add); \
} \
} else { \
(add)->next = (el)->next; \
(add)->prev = (el)->prev; \
(add)->prev->next = (add); \
if ((el)->next == NULL) { \
(head)->prev = (add); \
} else { \
(add)->next->prev = (add); \
} \
} \
} while (0)

Definition at line 753 of file utlist.h.

## DL_SEARCH

#define DL_SEARCH LL_SEARCH

Definition at line 749 of file utlist.h.

## DL_SEARCH2

#define DL_SEARCH2 LL_SEARCH2

Definition at line 751 of file utlist.h.

## DL_SEARCH_SCALAR

#define DL_SEARCH_SCALAR LL_SEARCH_SCALAR

Definition at line 748 of file utlist.h.

## DL_SEARCH_SCALAR2

#define DL_SEARCH_SCALAR2 LL_SEARCH_SCALAR2

Definition at line 750 of file utlist.h.

## DL_SORT

#define DL_SORT | ( |  | list,
|  |  | cmp
| ) |  | DL_SORT2(list, cmp, prev, next)

Definition at line 172 of file utlist.h.

## DL_SORT2

#define DL_SORT2 | ( |  | list,
|  |  | cmp,
|  |  | prev,
|  |  | next
| ) |  |

Definition at line 175 of file utlist.h.

## IF_NO_DECLTYPE

#define IF_NO_DECLTYPE | ( |  | x | ) |

Definition at line 94 of file utlist.h.

## LDECLTYPE

#define LDECLTYPE | ( |  | x | ) | __typeof(x)

Definition at line 76 of file utlist.h.

## LL_APPEND

#define LL_APPEND | ( |  | head,
|  |  | add
| ) |  | LL_APPEND2(head,add,next)

Definition at line 338 of file utlist.h.

## LL_APPEND2

#define LL_APPEND2 | ( |  | head,
|  |  | add,
|  |  | next
| ) |  |

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 341 of file utlist.h.

## LL_APPEND_ELEM

#define LL_APPEND_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | LL_APPEND_ELEM2(head, el, add, next)

Definition at line 506 of file utlist.h.

## LL_APPEND_ELEM2

#define LL_APPEND_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | next
| ) |  |

Value:
do { \
if (el) { \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \
(el)->next = (add); \
} else { \
LL_PREPEND2(head, add, next); \
} \
} while (0) \

Definition at line 494 of file utlist.h.

## LL_CONCAT

#define LL_CONCAT | ( |  | head1,
|  |  | head2
| ) |  | LL_CONCAT2(head1,head2,next)

Definition at line 323 of file utlist.h.

## LL_CONCAT2

#define LL_CONCAT2 | ( |  | head1,
|  |  | head2,
|  |  | next
| ) |  |

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 326 of file utlist.h.

## LL_COUNT

#define LL_COUNT | ( |  | head,
|  |  | el,
|  |  | counter
| ) |  | LL_COUNT2(head,el,counter,next) \

Definition at line 404 of file utlist.h.

## LL_COUNT2

#define LL_COUNT2 | ( |  | head,
|  |  | el,
|  |  | counter,
|  |  | next
| ) |  |

Value:
do { \
(counter) = 0; \
LL_FOREACH2(head,el,next) { ++(counter); } \
} while (0)

Definition at line 407 of file utlist.h.

## LL_DELETE

#define LL_DELETE | ( |  | head,
|  |  | del
| ) |  | LL_DELETE2(head,del,next)

Definition at line 385 of file utlist.h.

## LL_DELETE2

#define LL_DELETE2 | ( |  | head,
|  |  | del,
|  |  | next
| ) |  |

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 388 of file utlist.h.

## LL_FOREACH

#define LL_FOREACH | ( |  | head,
|  |  | el
| ) |  | LL_FOREACH2(head,el,next)

Definition at line 413 of file utlist.h.

## LL_FOREACH2

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

Definition at line 416 of file utlist.h.

## LL_FOREACH_SAFE

#define LL_FOREACH_SAFE | ( |  | head,
|  |  | el,
|  |  | tmp
| ) |  | LL_FOREACH_SAFE2(head,el,tmp,next)

Definition at line 419 of file utlist.h.

## LL_FOREACH_SAFE2

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

Definition at line 422 of file utlist.h.

## LL_INSERT_INORDER

#define LL_INSERT_INORDER | ( |  | head,
|  |  | add,
|  |  | cmp
| ) |  | LL_INSERT_INORDER2(head,add,cmp,next)

Definition at line 354 of file utlist.h.

## LL_INSERT_INORDER2

#define LL_INSERT_INORDER2 | ( |  | head,
|  |  | add,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
LDECLTYPE(head) _tmp; \
if (head) { \
LL_LOWER_BOUND(head, _tmp, add, cmp); \
LL_APPEND_ELEM(head, _tmp, add); \
} else { \
(head) = (add); \
(head)->next = NULL; \
} \
} while (0)

Definition at line 357 of file utlist.h.

## LL_LOWER_BOUND

#define LL_LOWER_BOUND | ( |  | head,
|  |  | elt,
|  |  | like,
|  |  | cmp
| ) |  | LL_LOWER_BOUND2(head,elt,like,cmp,next)

Definition at line 369 of file utlist.h.

## LL_LOWER_BOUND2

#define LL_LOWER_BOUND2 | ( |  | head,
|  |  | elt,
|  |  | like,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
if ((head) == NULL || (cmp(head, like)) >= 0) { \
(elt) = NULL; \
} else { \
for ((elt) = (head); (elt)->next != NULL; (elt) = (elt)->next) { \
if (cmp((elt)->next, like) >= 0) { \
break; \
} \
} \
} \
} while (0)

Definition at line 372 of file utlist.h.

## LL_PREPEND

#define LL_PREPEND | ( |  | head,
|  |  | add
| ) |  | LL_PREPEND2(head,add,next)

Definition at line 314 of file utlist.h.

## LL_PREPEND2

#define LL_PREPEND2 | ( |  | head,
|  |  | add,
|  |  | next
| ) |  |

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

Definition at line 317 of file utlist.h.

## LL_PREPEND_ELEM

#define LL_PREPEND_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | LL_PREPEND_ELEM2(head, el, add, next)

Definition at line 491 of file utlist.h.

## LL_PREPEND_ELEM2

#define LL_PREPEND_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | next
| ) |  |

Value:
do { \
if (el) { \
LDECLTYPE(head) _tmp; \
assert((head) != NULL); \
assert((add) != NULL); \
(add)->next = (el); \
if ((head) == (el)) { \
(head) = (add); \
} else { \
_tmp = (head); \
while (_tmp->next && (_tmp->next != (el))) { \
_tmp = _tmp->next; \
} \
if (_tmp->next) { \
_tmp->next = (add); \
} \
} \
} else { \
LL_APPEND2(head, add, next); \
} \
} while (0) \

Definition at line 468 of file utlist.h.

## LL_REPLACE_ELEM

#define LL_REPLACE_ELEM | ( |  | head,
|  |  | el,
|  |  | add
| ) |  | LL_REPLACE_ELEM2(head, el, add, next)

Definition at line 465 of file utlist.h.

## LL_REPLACE_ELEM2

#define LL_REPLACE_ELEM2 | ( |  | head,
|  |  | el,
|  |  | add,
|  |  | next
| ) |  |

Value:
do { \
LDECLTYPE(head) _tmp; \
assert((head) != NULL); \
assert((el) != NULL); \
assert((add) != NULL); \
(add)->next = (el)->next; \
if ((head) == (el)) { \
(head) = (add); \
} else { \
_tmp = (head); \
while (_tmp->next && (_tmp->next != (el))) { \
_tmp = _tmp->next; \
} \
if (_tmp->next) { \
_tmp->next = (add); \
} \
} \
} while (0)

Definition at line 445 of file utlist.h.

## LL_SEARCH

#define LL_SEARCH | ( |  | head,
|  |  | out,
|  |  | elt,
|  |  | cmp
| ) |  | LL_SEARCH2(head,out,elt,cmp,next)

Definition at line 435 of file utlist.h.

## LL_SEARCH2

#define LL_SEARCH2 | ( |  | head,
|  |  | out,
|  |  | elt,
|  |  | cmp,
|  |  | next
| ) |  |

Value:
do { \
LL_FOREACH2(head,out,next) { \
if ((cmp(out,elt))==0) break; \
} \
} while (0)

Definition at line 438 of file utlist.h.

## LL_SEARCH_SCALAR

#define LL_SEARCH_SCALAR | ( |  | head,
|  |  | out,
|  |  | field,
|  |  | val
| ) |  | LL_SEARCH_SCALAR2(head,out,field,val,next)

Definition at line 425 of file utlist.h.

## LL_SEARCH_SCALAR2

#define LL_SEARCH_SCALAR2 | ( |  | head,
|  |  | out,
|  |  | field,
|  |  | val,
|  |  | next
| ) |  |

Value:
do { \
LL_FOREACH2(head,out,next) { \
if ((out)->field == (val)) break; \
} \
} while (0)

Definition at line 428 of file utlist.h.

## LL_SORT

#define LL_SORT | ( |  | list,
|  |  | cmp
| ) |  | LL_SORT2(list, cmp, next)

Definition at line 108 of file utlist.h.

## LL_SORT2

#define LL_SORT2 | ( |  | list,
|  |  | cmp,
|  |  | next
| ) |  |

Definition at line 111 of file utlist.h.

## UTLIST_CASTASGN

#define UTLIST_CASTASGN | ( |  | a,
|  |  | b
| ) |  | (a)=(b)

Definition at line 101 of file utlist.h.

## UTLIST_NEXT

#define UTLIST_NEXT | ( |  | elt,
|  |  | list,
|  |  | next
| ) |  | ((elt)->next)

Definition at line 96 of file utlist.h.

## UTLIST_NEXTASGN

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

Definition at line 97 of file utlist.h.

## UTLIST_PREVASGN

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

Definition at line 99 of file utlist.h.

## UTLIST_RS

#define UTLIST_RS | ( |  | list | ) |

Definition at line 100 of file utlist.h.

## UTLIST_SV

#define UTLIST_SV | ( |  | elt,
|  |  | list
| ) |  |

Definition at line 95 of file utlist.h.

## UTLIST_VERSION

#define UTLIST_VERSION 2.0.2

Definition at line 27 of file utlist.h.