4 * Copyright (C) 2009 Red Hat Inc.
7 * Luiz Capitulino <lcapitulino@redhat.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
17 #include "qemu-queue.h"
18 #include "qemu-common.h"
20 typedef struct QListEntry
{
22 QTAILQ_ENTRY(QListEntry
) next
;
25 typedef struct QList
{
27 QTAILQ_HEAD(,QListEntry
) head
;
30 #define qlist_append(qlist, obj) \
31 qlist_append_obj(qlist, QOBJECT(obj))
33 #define QLIST_FOREACH_ENTRY(qlist, var) \
34 for ((var) = ((qlist)->head.tqh_first); \
36 (var) = ((var)->next.tqe_next))
38 static inline QObject
*qlist_entry_obj(const QListEntry
*entry
)
43 QList
*qlist_new(void);
44 QList
*qlist_copy(QList
*src
);
45 void qlist_append_obj(QList
*qlist
, QObject
*obj
);
46 void qlist_iter(const QList
*qlist
,
47 void (*iter
)(QObject
*obj
, void *opaque
), void *opaque
);
48 QObject
*qlist_pop(QList
*qlist
);
49 QObject
*qlist_peek(QList
*qlist
);
50 int qlist_empty(const QList
*qlist
);
51 QList
*qobject_to_qlist(const QObject
*obj
);