Patchwork [v1,05/23] qlist: add qlist_first()/qlist_next()

login
register
mail settings
Submitter Michael Roth
Date May 18, 2011, 12:51 a.m.
Message ID <1305679930-4215-6-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/96094/
State New
Headers show

Comments

Michael Roth - May 18, 2011, 12:51 a.m.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qlist.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
Stefan Hajnoczi - May 18, 2011, 8:12 a.m.
On Wed, May 18, 2011 at 1:51 AM, Michael Roth <mdroth@linux.vnet.ibm.com> wrote:
>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  qlist.h |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/qlist.h b/qlist.h
> index dbe7b92..13f22eb 100644
> --- a/qlist.h
> +++ b/qlist.h
> @@ -50,4 +50,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 qlist->head.tqh_first;

return QTAILQ_FIRST(&qlist->head);

> +}
> +
> +static inline QListEntry *qlist_next(QListEntry *entry)
> +{
> +    return entry->next.tqe_next;

return QTAILQ_NEXT(&entry->next);

Patch

diff --git a/qlist.h b/qlist.h
index dbe7b92..13f22eb 100644
--- a/qlist.h
+++ b/qlist.h
@@ -50,4 +50,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 qlist->head.tqh_first;
+}
+
+static inline QListEntry *qlist_next(QListEntry *entry)
+{
+    return entry->next.tqe_next;
+}
+
 #endif /* QLIST_H */