Lines Matching refs:QList
2 * QList Module
13 #include "qlist.h"
26 * qlist_new(): Create a new QList
30 QList *qlist_new(void)
32 QList *qlist;
34 qlist = qemu_malloc(sizeof(*qlist));
35 QTAILQ_INIT(&qlist->head);
36 QOBJECT_INIT(qlist, &qlist_type);
38 return qlist;
43 QList *dst = opaque;
49 QList *qlist_copy(QList *src)
51 QList *dst = qlist_new();
59 * qlist_append_obj(): Append an QObject into QList
61 * NOTE: ownership of 'value' is transferred to the QList
63 void qlist_append_obj(QList *qlist, QObject *value)
70 QTAILQ_INSERT_TAIL(&qlist->head, entry, next);
79 void qlist_iter(const QList *qlist,
84 QTAILQ_FOREACH(entry, &qlist->head, next)
88 QObject *qlist_pop(QList *qlist)
93 if (qlist == NULL || QTAILQ_EMPTY(&qlist->head)) {
97 entry = QTAILQ_FIRST(&qlist->head);
98 QTAILQ_REMOVE(&qlist->head, entry, next);
106 QObject *qlist_peek(QList *qlist)
111 if (qlist == NULL || QTAILQ_EMPTY(&qlist->head)) {
115 entry = QTAILQ_FIRST(&qlist->head);
122 int qlist_empty(const QList *qlist)
124 return QTAILQ_EMPTY(&qlist->head);
128 * qobject_to_qlist(): Convert a QObject into a QList
130 QList *qobject_to_qlist(const QObject *obj)
136 return container_of(obj, QList, base);
140 * qlist_destroy_obj(): Free all the memory allocated by a QList
144 QList *qlist;
148 qlist = qobject_to_qlist(obj);
150 QTAILQ_FOREACH_SAFE(entry, &qlist->head, next, next_entry) {
151 QTAILQ_REMOVE(&qlist->head, entry, next);
156 qemu_free(qlist);