aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roth <mdroth@linux.vnet.ibm.com>2011-07-19 14:50:30 -0500
committerLuiz Capitulino <lcapitulino@gmail.com>2011-07-21 16:48:13 -0300
commit54d83804a1f69e932e014842e7e7a4744334123d (patch)
tree4581e9ca5095084a8d543dcbd17bb03caa7ff032
parente18df14185e817ba735bce57ecdef9a55fb3d093 (diff)
qlist: add qlist_first()/qlist_next()
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
-rw-r--r--qlist.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/qlist.h b/qlist.h
index dbe7b92db5..d426bd4a4b 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 const QListEntry *qlist_first(const QList *qlist)
+{
+ return QTAILQ_FIRST(&qlist->head);
+}
+
+static inline const QListEntry *qlist_next(const QListEntry *entry)
+{
+ return QTAILQ_NEXT(entry, next);
+}
+
#endif /* QLIST_H */