[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 14/23] qlist: add qlist_size()
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 14/23] qlist: add qlist_size() |
Date: |
Tue, 21 Aug 2012 12:05:48 -0500 |
Signed-off-by: Michael Roth <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit a86a4c2f7b7f0b72816ea1c219d8140699b6665b)
Signed-off-by: Michael Roth <address@hidden>
---
qlist.c | 13 +++++++++++++
qlist.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/qlist.c b/qlist.c
index 88498b1..b48ec5b 100644
--- a/qlist.c
+++ b/qlist.c
@@ -124,6 +124,19 @@ int qlist_empty(const QList *qlist)
return QTAILQ_EMPTY(&qlist->head);
}
+static void qlist_size_iter(QObject *obj, void *opaque)
+{
+ size_t *count = opaque;
+ (*count)++;
+}
+
+size_t qlist_size(const QList *qlist)
+{
+ size_t count = 0;
+ qlist_iter(qlist, qlist_size_iter, &count);
+ return count;
+}
+
/**
* qobject_to_qlist(): Convert a QObject into a QList
*/
diff --git a/qlist.h b/qlist.h
index d426bd4..ae776f9 100644
--- a/qlist.h
+++ b/qlist.h
@@ -49,6 +49,7 @@ void qlist_iter(const QList *qlist,
QObject *qlist_pop(QList *qlist);
QObject *qlist_peek(QList *qlist);
int qlist_empty(const QList *qlist);
+size_t qlist_size(const QList *qlist);
QList *qobject_to_qlist(const QObject *obj);
static inline const QListEntry *qlist_first(const QList *qlist)
--
1.7.9.5
- [Qemu-devel] [PATCH 03/23] ppc: Fix bug in handling of PAPR hypercall exits, (continued)
- [Qemu-devel] [PATCH 03/23] ppc: Fix bug in handling of PAPR hypercall exits, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 05/23] kvmvapic: Disable if there is insufficient memory, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 04/23] s390: Fix error handling and condition code of service call, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 01/23] qtest: fix infinite loop when QEMU aborts abruptly, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 07/23] virtio-blk: fix use-after-free while handling scsi commands, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 08/23] ehci: fix reset, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 06/23] qdev: fix use-after-free in the error path of qdev_init_nofail, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 13/23] usb-ehci: Fix an assert whenever isoc transfers are used, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 11/23] usb: restore USBDevice->attached on vmload, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 10/23] uhci: fix uhci_async_cancel_all, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 14/23] qlist: add qlist_size(),
Michael Roth <=
- [Qemu-devel] [PATCH 09/23] ehci: don't flush cache on doorbell rings., Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 12/23] usb-redir: Correctly handle the usb_redir_babble usbredir status, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 16/23] check-qjson: add test for large JSON objects, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 17/23] slirp: Enforce host-side user of smb share, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 15/23] json-parser: don't replicate tokens at each level of recursion, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 19/23] slirp: Improve error reporting of inaccessible smb directories, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 23/23] update VERSION for 1.1.2, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 22/23] apic: Defer interrupt updates to VCPU thread, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 20/23] apic: Resolve potential endless loop around apic_update_irq, Michael Roth, 2012/08/21
- [Qemu-devel] [PATCH 18/23] slirp: Ensure smbd and shared directory exist when enable smb, Michael Roth, 2012/08/21