summaryrefslogtreecommitdiff
path: root/pjlib/include/pj/list_i.h
diff options
context:
space:
mode:
Diffstat (limited to 'pjlib/include/pj/list_i.h')
-rw-r--r--pjlib/include/pj/list_i.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/pjlib/include/pj/list_i.h b/pjlib/include/pj/list_i.h
index c6d95c80..2a8bf582 100644
--- a/pjlib/include/pj/list_i.h
+++ b/pjlib/include/pj/list_i.h
@@ -116,3 +116,17 @@ pj_list_search(pj_list_type *list, void *value,
return p==list ? NULL : p;
}
+
+PJ_IDEF(pj_size_t) pj_list_size(pj_list_type *list)
+{
+ pj_list *node = (pj_list*) ((pj_list*)list)->next;
+ pj_size_t count = 0;
+
+ while (node != list) {
+ ++count;
+ node = node->next;
+ }
+
+ return count;
+}
+