From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUMuP-0005Mf-RN for qemu-devel@nongnu.org; Wed, 08 Jun 2011 13:51:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUMuO-0003hJ-HR for qemu-devel@nongnu.org; Wed, 08 Jun 2011 13:51:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUMuO-0003gT-2T for qemu-devel@nongnu.org; Wed, 08 Jun 2011 13:51:12 -0400 Date: Wed, 8 Jun 2011 14:50:59 -0300 From: Luiz Capitulino Message-ID: <20110608145059.56aaa5a1@doriath> In-Reply-To: <1307140399-9023-3-git-send-email-mdroth@linux.vnet.ibm.com> References: <1307140399-9023-1-git-send-email-mdroth@linux.vnet.ibm.com> <1307140399-9023-3-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 v2][ 02/21] qlist: add qlist_first()/qlist_next() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com, qemu-devel@nongnu.org, Jes.Sorensen@redhat.com On Fri, 3 Jun 2011 17:33:00 -0500 Michael Roth wrote: > > Signed-off-by: Michael Roth > --- > qlist.h | 11 +++++++++++ > 1 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/qlist.h b/qlist.h > index dbe7b92..cd2d23e 100644 > --- a/qlist.h > +++ b/qlist.h > @@ -16,6 +16,7 @@ > #include "qobject.h" > #include "qemu-queue.h" > #include "qemu-common.h" > +#include "qemu-queue.h" > > typedef struct QListEntry { > QObject *value; > @@ -50,4 +51,14 @@ QObject *qlist_peek(QList *qlist); > int qlist_empty(const QList *qlist); > QList *qobject_to_qlist(const QObject *obj); > > +static inline QListEntry *qlist_first(QList *qlist) > +{ > + return QTAILQ_FIRST(&qlist->head); > +} > + > +static inline QListEntry *qlist_next(QListEntry *entry) > +{ > + return QTAILQ_NEXT(entry, next); > +} I'm not sure how the return value (QListEntry) is being used, but the same interface for qdict returns a const value and users use get functions to get visible members. The rationale is that QListEntry and QDictEntry shouldn't be visible to users. And the input parameter can be const too and would be nice to have unit-tests... > + > #endif /* QLIST_H */