aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/queue.h
diff options
context:
space:
mode:
authorEmilio G. Cota <cota@braap.org>2018-12-06 19:04:07 -0500
committerAlex Bennée <alex.bennee@linaro.org>2019-10-28 15:12:38 +0000
commit050ec8cc18f020b3231db3311241cd3534e7a15f (patch)
tree093346889e18674b8b21e1c2ae8f1ff38dd93d45 /include/qemu/queue.h
parent5c5d69b0d523ad335b901800fc443aec77ec4688 (diff)
downloadqemu-050ec8cc18f020b3231db3311241cd3534e7a15f.zip
qemu-050ec8cc18f020b3231db3311241cd3534e7a15f.tar.gz
qemu-050ec8cc18f020b3231db3311241cd3534e7a15f.tar.bz2
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>
Diffstat (limited to 'include/qemu/queue.h')
-rw-r--r--include/qemu/queue.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index 73bf4a9..4764d93 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -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); \