SIP-router core :: circular list maintenance macros.
More...
Go to the source code of this file.
Defines
-
#define clist_append(head, c, next, prev) clist_append_sublist(head, c, c, next, prev)
- append at the end of the list (head->prev)
- #define clist_append_sublist(head, s, e, next, prev)
- appends an entire sublist { s,e } (including s & e ) at the end of the list
-
#define clist_foreach(head, v, dir) for((v)=(head)->dir; (v)!=(void*)(head); (v)=(v)->dir)
- iterate on a clist
- #define clist_foreach_safe(head, v, bak,dir)
- iterate on a clist, safe version (requires an extra bak.
-
#define clist_init(c, next, prev)
- circular list
-
#define clist_insert(head, c, next, prev) clist_insert_sublist(head, c, c, next, prev)
- insert after (head)
- #define clist_insert_sublist(head, s, e, next, prev)
- adds an entire sublist { s,e } (including s & e ) after head
-
#define clist_rm(c, next, prev) clist_rm_sublist(c, c, next, prev)
- remove and element
-
#define clist_rm_sublist(s, e, next, prev)
- remove sublist { s,e } (including s & e ) always, if start is the beginning of the list use clist_rm_sublist(head->next, e, next, prev ) WARNING: clist_rm_sublist(n, n->prev, ...) won't work, (macro!), use e=n->prev; clist_rm_sublist(n, e, ...) instead!
Detailed Description
Module: SIP-router core
Definition in file clist.h.
Define Documentation
| #define clist_append_sublist |
( |
|
head, |
|
|
|
s, |
|
|
|
e, |
|
|
|
next, |
|
|
|
prev | |
|
) |
| | |
Value:do{ \
(s)->prev=(head)->prev; \
(e)->next=(void*)(head); \
(s)->prev->next=(s); \
(head)->prev=(e); \
}while(0)
WARNING: clist_append_sublist(head, n, n->prev, ...) won't work, (macro!), use e=n->prev; clist_append_sublist(head, n, e, ...) instead!
Definition at line 75 of file clist.h.
| #define clist_foreach_safe |
( |
|
head, |
|
|
|
v, |
|
|
|
bak, |
|
|
|
dir | |
|
) |
| | |
Value:for((v)=(head)->dir, (bak)=(v)->dir; (v)!=(void*)(head); \
(v)=(bak), (bak)=(v)->dir)
var) (it allows removing of the current element)
Definition at line 124 of file clist.h.
| #define clist_insert_sublist |
( |
|
head, |
|
|
|
s, |
|
|
|
e, |
|
|
|
next, |
|
|
|
prev | |
|
) |
| | |
Value:do{ \
(s)->prev=(void*)(head); \
(e)->next=(head)->next; \
(e)->next->prev=(e); \
(head)->next=s; \
}while(0)
- Note:
- WARNING: clist_insert_sublist(head, n, n->prev) won't work, same for clist_insert_sublist(head, n->next, n) (macro!), use e=n->prev; clist_insert_sublist(head, n, e, ...) instead!
Definition at line 58 of file clist.h.