[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 10/55] queue: add QTAILQ_REMOVE_SEVERAL
From: |
Alex Bennée |
Subject: |
[PATCH v5 10/55] queue: add QTAILQ_REMOVE_SEVERAL |
Date: |
Mon, 14 Oct 2019 11:49:03 +0100 |
From: "Emilio G. Cota" <address@hidden>
This is faster than removing elements one by one.
Will gain a user soon.
Signed-off-by: Emilio G. Cota <address@hidden>
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <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 73bf4a984d..4764d93ea3 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); \
--
2.20.1
- [PATCH for 4.2 v5 00/55] Support for TCG plugins, Alex Bennée, 2019/10/14
- [PATCH v5 01/55] trace: expand mem_info:size_shift to 4 bits, Alex Bennée, 2019/10/14
- [PATCH v5 04/55] translate-all: use cpu_in_exclusive_work_context() in tb_flush, Alex Bennée, 2019/10/14
- [PATCH v5 05/55] docs/devel: add plugins.rst design document, Alex Bennée, 2019/10/14
- [PATCH v5 03/55] cpu: introduce cpu_in_exclusive_context(), Alex Bennée, 2019/10/14
- [PATCH v5 06/55] configure: add --enable-plugins (MOVE TO END), Alex Bennée, 2019/10/14
- [PATCH v5 02/55] trace: add mmu_index to mem_info, Alex Bennée, 2019/10/14
- [PATCH v5 09/55] plugin: add implementation of the api, Alex Bennée, 2019/10/14
- [PATCH v5 10/55] queue: add QTAILQ_REMOVE_SEVERAL,
Alex Bennée <=
- [PATCH v5 07/55] plugin: add user-facing API, Alex Bennée, 2019/10/14
- [PATCH v5 11/55] cputlb: document get_page_addr_code, Alex Bennée, 2019/10/14
- [PATCH v5 24/55] target/arm: fetch code with translator_ld, Alex Bennée, 2019/10/14
- [PATCH v5 22/55] plugin-gen: add plugin_insn_append, Alex Bennée, 2019/10/14
- [PATCH v5 15/55] atomic_template: add inline trace/plugin helpers, Alex Bennée, 2019/10/14
- [PATCH v5 20/55] *-user: plugin syscalls, Alex Bennée, 2019/10/14
- [PATCH v5 25/55] target/ppc: fetch code with translator_ld, Alex Bennée, 2019/10/14
- [PATCH v5 12/55] cputlb: introduce get_page_addr_code_hostp, Alex Bennée, 2019/10/14
- [PATCH v5 50/55] include/exec: wrap cpu_ldst.h in CONFIG_TCG, Alex Bennée, 2019/10/14
- [PATCH v5 21/55] cpu: hook plugin vcpu events, Alex Bennée, 2019/10/14