[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/8] Add QLIST_INSERT_TAIL
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] [PATCH 7/8] Add QLIST_INSERT_TAIL |
Date: |
Fri, 14 May 2010 15:20:51 +0200 |
As the QLIST has not tail pointer, this requires list walking. Still
useful when lists are short or insertion time doesn't matter.
Signed-off-by: Jan Kiszka <address@hidden>
---
qemu-queue.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/qemu-queue.h b/qemu-queue.h
index 1d07745..99ed1f6 100644
--- a/qemu-queue.h
+++ b/qemu-queue.h
@@ -122,6 +122,15 @@ struct {
\
(elm)->field.le_prev = &(head)->lh_first; \
} while (/*CONSTCOND*/0)
+#define QLIST_INSERT_TAIL(head, elm, field) do { \
+ typeof((head)->lh_first) *qlist_lastptr = &(head)->lh_first; \
+ while (*qlist_lastptr) \
+ qlist_lastptr = &(*qlist_lastptr)->field.le_next; \
+ (elm)->field.le_next = NULL; \
+ *qlist_lastptr = (elm); \
+ (elm)->field.le_prev = qlist_lastptr; \
+} while (/*CONSTCOND*/0)
+
#define QLIST_REMOVE(elm, field) do { \
if ((elm)->field.le_next != NULL) \
(elm)->field.le_next->field.le_prev = \
--
1.6.0.2
- Re: [Qemu-devel] [PATCH 1/8] qdev: Allow device addressing via 'driver.instance', (continued)
[Qemu-devel] [PATCH 5/8] qmp: Teach basic capability negotiation to python example, Jan Kiszka, 2010/05/14
[Qemu-devel] [PATCH 4/8] monitor: Add basic device state visualization, Jan Kiszka, 2010/05/14
[Qemu-devel] [PATCH 7/8] Add QLIST_INSERT_TAIL,
Jan Kiszka <=
[Qemu-devel] [PATCH 2/8] Add base64 encoder/decoder, Jan Kiszka, 2010/05/14
[Qemu-devel] [PATCH 8/8] qdev: Add new devices/buses at the tail, Jan Kiszka, 2010/05/14
[Qemu-devel] [PATCH 6/8] qmp: Fix python helper /wrt long return strings, Jan Kiszka, 2010/05/14
[Qemu-devel] [PATCH 3/8] Add QBuffer, Jan Kiszka, 2010/05/14