2 * QList data type header.
4 * Copyright (C) 2009 Red Hat Inc.
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.
16 #include "qemu-queue.h"
17 #include "qemu-common.h"
19 typedef struct QListEntry
{
21 QTAILQ_ENTRY(QListEntry
) next
;
24 typedef struct QList
{
26 QTAILQ_HEAD(,QListEntry
) head
;
29 #define qlist_append(qlist, obj) \
30 qlist_append_obj(qlist, QOBJECT(obj))
32 #define QLIST_FOREACH_ENTRY(qlist, var) \
33 for ((var) = ((qlist)->head.tqh_first); \
35 (var) = ((var)->next.tqe_next))
37 static inline QObject
*qlist_entry_obj(const QListEntry
*entry
)
42 QList
*qlist_new(void);
43 QList
*qlist_copy(QList
*src
);
44 void qlist_append_obj(QList
*qlist
, QObject
*obj
);
45 void qlist_iter(const QList
*qlist
,
46 void (*iter
)(QObject
*obj
, void *opaque
), void *opaque
);
47 QObject
*qlist_pop(QList
*qlist
);
48 QObject
*qlist_peek(QList
*qlist
);
49 int qlist_empty(const QList
*qlist
);
50 QList
*qobject_to_qlist(const QObject
*obj
);