From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T20IL-0004ao-D1 for qemu-devel@nongnu.org; Thu, 16 Aug 2012 09:39:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T20IH-0001n0-6l for qemu-devel@nongnu.org; Thu, 16 Aug 2012 09:39:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:2260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T20IG-0001mp-Uy for qemu-devel@nongnu.org; Thu, 16 Aug 2012 09:39:25 -0400 Date: Thu, 16 Aug 2012 10:40:05 -0300 From: Luiz Capitulino Message-ID: <20120816104005.67581ecf@doriath.home> In-Reply-To: <1345056344-31849-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1345056344-31849-1-git-send-email-mdroth@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH for-1.2 v3 1/3] qlist: add qlist_size() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: aliguori@us.ibm.com, eblake@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com On Wed, 15 Aug 2012 13:45:42 -0500 Michael Roth wrote: > > Signed-off-by: Michael Roth I've applied this series to the qmp branch for 1.2. I'll run some tests and if all goes alright will send a pull request shortly. > --- > 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)