[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 07/38] queue: add QTAILQ_REMOVE_SEVERAL
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC v2 07/38] queue: add QTAILQ_REMOVE_SEVERAL |
Date: |
Sun, 9 Dec 2018 14:37:18 -0500 |
This is faster than removing elements one by one.
Will gain a user soon.
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/qemu/queue.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index ac418efc43..0283c2dd7d 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -419,6 +419,16 @@ struct {
\
(elm)->field.tqe_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_prev = \
+ (left)->field.tqe_prev; \
+ else \
+ (head)->tqh_last = (left)->field.tqe_prev; \
+ *(left)->field.tqe_prev = (right)->field.tqe_next; \
+ } while (/*CONSTCOND*/0)
+
#define QTAILQ_FOREACH(var, head, field) \
for ((var) = ((head)->tqh_first); \
(var); \
--
2.17.1
- [Qemu-devel] [RFC v2 00/38] Plugin support, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 02/38] tcg/README: fix typo s/afterwise/afterwards/, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 03/38] cpu: introduce cpu_in_exclusive_work_context(), Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 01/38] trace: expand mem_info:size_shift to 3 bits, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 04/38] translate-all: use cpu_in_exclusive_work_context() in tb_flush, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 05/38] plugin: add user-facing API, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 11/38] tcg: add tcg_gen_st_ptr, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 07/38] queue: add QTAILQ_REMOVE_SEVERAL,
Emilio G. Cota <=
- [Qemu-devel] [RFC v2 12/38] tcg: add MO_HADDR to TCGMemOp, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 06/38] plugin: add core code, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 09/38] cputlb: introduce get_page_addr_code_hostp, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 23/38] target/ppc: fetch code with translator_ld, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 16/38] translate-all: notify plugin code of tb_flush, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 14/38] atomic_template: add inline trace/plugin helpers, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 17/38] *-user: notify plugin of exit, Emilio G. Cota, 2018/12/09
- [Qemu-devel] [RFC v2 13/38] atomic_template: fix indentation in GEN_ATOMIC_HELPER, Emilio G. Cota, 2018/12/09