projects
/
sdk
/
emulator
/
qemu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sync with latest
[sdk/emulator/qemu.git]
/
qlist.c
diff --git
a/qlist.c
b/qlist.c
index
5730fb8
..
b48ec5b
100644
(file)
--- a/
qlist.c
+++ b/
qlist.c
@@
-31,7
+31,7
@@
QList *qlist_new(void)
{
QList *qlist;
{
QList *qlist;
- qlist =
qemu
_malloc(sizeof(*qlist));
+ qlist =
g
_malloc(sizeof(*qlist));
QTAILQ_INIT(&qlist->head);
QOBJECT_INIT(qlist, &qlist_type);
QTAILQ_INIT(&qlist->head);
QOBJECT_INIT(qlist, &qlist_type);
@@
-64,7
+64,7
@@
void qlist_append_obj(QList *qlist, QObject *value)
{
QListEntry *entry;
{
QListEntry *entry;
- entry =
qemu
_malloc(sizeof(*entry));
+ entry =
g
_malloc(sizeof(*entry));
entry->value = value;
QTAILQ_INSERT_TAIL(&qlist->head, entry, next);
entry->value = value;
QTAILQ_INSERT_TAIL(&qlist->head, entry, next);
@@
-98,7
+98,7
@@
QObject *qlist_pop(QList *qlist)
QTAILQ_REMOVE(&qlist->head, entry, next);
ret = entry->value;
QTAILQ_REMOVE(&qlist->head, entry, next);
ret = entry->value;
-
qemu
_free(entry);
+
g
_free(entry);
return ret;
}
return ret;
}
@@
-124,6
+124,19
@@
int qlist_empty(const QList *qlist)
return QTAILQ_EMPTY(&qlist->head);
}
return QTAILQ_EMPTY(&qlist->head);
}
+static void qlist_size_iter(QObject *obj, void *opaque)
+{
+ size_t *count = opaque;
+ (*count)++;
+}
+
+size_t qlist_size(const QList *qlist)
+{
+ size_t count = 0;
+ qlist_iter(qlist, qlist_size_iter, &count);
+ return count;
+}
+
/**
* qobject_to_qlist(): Convert a QObject into a QList
*/
/**
* qobject_to_qlist(): Convert a QObject into a QList
*/
@@
-150,8
+163,8
@@
static void qlist_destroy_obj(QObject *obj)
QTAILQ_FOREACH_SAFE(entry, &qlist->head, next, next_entry) {
QTAILQ_REMOVE(&qlist->head, entry, next);
qobject_decref(entry->value);
QTAILQ_FOREACH_SAFE(entry, &qlist->head, next, next_entry) {
QTAILQ_REMOVE(&qlist->head, entry, next);
qobject_decref(entry->value);
-
qemu
_free(entry);
+
g
_free(entry);
}
}
-
qemu
_free(qlist);
+
g
_free(qlist);
}
}