mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-29 06:40:59 +01:00
MINOR: lists: add new macro LIST_SPLICE_END_DETACHED
This macro adds a detached list at the end of an existing list. The detached list is a list without head, containing only elements.
This commit is contained in:
parent
6d4897eec0
commit
c32a0e522f
@ -104,6 +104,19 @@ struct cond_wordlist {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* adds the contents of a list whose first element is <old> and last one is
|
||||
* <old->prev> at the end of another list <new>. The old list DOES NOT have
|
||||
* any head here.
|
||||
*/
|
||||
#define LIST_SPLICE_END_DETACHED(new, old) do { \
|
||||
typeof(new) __t; \
|
||||
(new)->p->n = (old); \
|
||||
(old)->p->n = (new); \
|
||||
__t = (old)->p; \
|
||||
(old)->p = (new)->p; \
|
||||
(new)->p = __t; \
|
||||
} while (0)
|
||||
|
||||
/* removes an element from a list and returns it */
|
||||
#define LIST_DEL(el) ({ typeof(el) __ret = (el); (el)->n->p = (el)->p; (el)->p->n = (el)->n; (__ret); })
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user