summaryrefslogtreecommitdiff
path: root/include/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/list.h')
-rw-r--r--include/list.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/list.h b/include/list.h
index ad87b45b..1d36e163 100644
--- a/include/list.h
+++ b/include/list.h
@@ -102,5 +102,16 @@ list_del(struct list_head *entry)
for (pos = (head)->prev, n = pos->prev; pos != (head); \
pos = n, n = pos->prev)
+static inline size_t
+list_size(struct list_head *entry)
+{
+ list_t *pos;
+ size_t i = 0;
+ list_for_each(pos, entry) {
+ i++;
+ }
+ return i;
+}
+
#endif /* !LIST_H_ */
// vim:fenc=utf-8:tw=75:noet