summaryrefslogtreecommitdiff
path: root/src/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/list.h')
-rw-r--r--src/list.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/list.h b/src/list.h
index 81ad31e..6c7e79f 100644
--- a/src/list.h
+++ b/src/list.h
@@ -514,4 +514,19 @@ static inline void hlist_add_after(struct hlist_node *n,
pos = n)
+/**
+ * list_count - return length of list
+ * @head the head for your list.
+ */
+static inline int list_count(struct list_head *head)
+{
+ int n = 0;
+ struct list_head *p;
+
+ list_for_each(p, head) n++;
+ return n;
+}
+
+
#endif
+