Merge branch 'upstream-merge'
[qemu-kvm/markmc.git] / qlist.h
blob3eb1eb83b2826f640acf41738b75e0f178fb58e4
1 /*
2 * QList data type header.
4 * Copyright (C) 2009 Red Hat Inc.
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
12 #ifndef QLIST_H
13 #define QLIST_H
15 #include "qobject.h"
16 #include "qemu-queue.h"
17 #include "qemu-common.h"
19 typedef struct QListEntry {
20 QObject *value;
21 QTAILQ_ENTRY(QListEntry) next;
22 } QListEntry;
24 typedef struct QList {
25 QObject_HEAD;
26 QTAILQ_HEAD(,QListEntry) head;
27 } QList;
29 #define qlist_append(qlist, obj) \
30 qlist_append_obj(qlist, QOBJECT(obj))
32 QList *qlist_new(void);
33 void qlist_append_obj(QList *qlist, QObject *obj);
34 void qlist_iter(const QList *qlist,
35 void (*iter)(QObject *obj, void *opaque), void *opaque);
36 QList *qobject_to_qlist(const QObject *obj);
38 #endif /* QLIST_H */