queue: add QTAILQ_REMOVE_SEVERAL
This is faster than removing elements one by one. Will gain a user soon. Signed-off-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
5c5d69b0d5
commit
050ec8cc18
|
@ -420,6 +420,16 @@ union { \
|
|||
(elm)->field.tqe_circ.tql_prev = NULL; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/* remove @left, @right and all elements in between from @head */
|
||||
#define QTAILQ_REMOVE_SEVERAL(head, left, right, field) do { \
|
||||
if (((right)->field.tqe_next) != NULL) \
|
||||
(right)->field.tqe_next->field.tqe_circ.tql_prev = \
|
||||
(left)->field.tqe_circ.tql_prev; \
|
||||
else \
|
||||
(head)->tqh_circ.tql_prev = (left)->field.tqe_circ.tql_prev; \
|
||||
(left)->field.tqe_circ.tql_prev->tql_next = (right)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define QTAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var); \
|
||||
|
|
Loading…
Reference in a new issue