[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 09/54] queue: add QTAILQ_REMOVE_SEVERAL
From: |
Alex Bennée |
Subject: |
[PATCH v6 09/54] queue: add QTAILQ_REMOVE_SEVERAL |
Date: |
Thu, 17 Oct 2019 14:15:30 +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 v6 00/54] Support for TCG plugins, Alex Bennée, 2019/10/17
- [PATCH v6 01/54] trace: expand mem_info:size_shift to 4 bits, Alex Bennée, 2019/10/17
- [PATCH v6 03/54] cpu: introduce cpu_in_exclusive_context(), Alex Bennée, 2019/10/17
- [PATCH v6 04/54] translate-all: use cpu_in_exclusive_work_context() in tb_flush, Alex Bennée, 2019/10/17
- [PATCH v6 12/54] tcg: add tcg_gen_st_ptr, Alex Bennée, 2019/10/17
- [PATCH v6 02/54] trace: add mmu_index to mem_info, Alex Bennée, 2019/10/17
- [PATCH v6 06/54] plugin: add user-facing API, Alex Bennée, 2019/10/17
- [PATCH v6 08/54] plugin: add implementation of the api, Alex Bennée, 2019/10/17
- [PATCH v6 05/54] docs/devel: add plugins.rst design document, Alex Bennée, 2019/10/17
- [PATCH v6 09/54] queue: add QTAILQ_REMOVE_SEVERAL,
Alex Bennée <=
- [PATCH v6 10/54] cputlb: document get_page_addr_code, Alex Bennée, 2019/10/17
- [PATCH v6 23/54] target/arm: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 21/54] plugin-gen: add plugin_insn_append, Alex Bennée, 2019/10/17
- [PATCH v6 19/54] *-user: plugin syscalls, Alex Bennée, 2019/10/17
- [PATCH v6 11/54] cputlb: introduce get_page_addr_code_hostp, Alex Bennée, 2019/10/17
- [PATCH v6 07/54] plugin: add core code, Alex Bennée, 2019/10/17
- [PATCH v6 42/54] tests/plugin: add sample plugins, Alex Bennée, 2019/10/17
- [PATCH v6 24/54] target/ppc: fetch code with translator_ld, Alex Bennée, 2019/10/17
- [PATCH v6 13/54] plugin-gen: add module for TCG-related code, Alex Bennée, 2019/10/17
- [PATCH v6 39/54] plugin: add qemu_plugin_outs helper, Alex Bennée, 2019/10/17