summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'qlist.c')
-rw-r--r--qlist.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/qlist.c b/qlist.c
index 88498b157..b48ec5b91 100644
--- a/qlist.c
+++ b/qlist.c
@@ -124,6 +124,19 @@ int qlist_empty(const QList *qlist)
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
*/