From 8499c4f84a664bedbdf5a5689cb02420909f1968 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Sat, 19 Sep 2015 01:25:54 +0200 Subject: common: Add new function strlist_length. * common/strlist.c (strlist_length): New function. -- Signed-off-by: Neal H. Walfield . --- common/strlist.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/strlist.c') diff --git a/common/strlist.c b/common/strlist.c index 967509c56..9bd6195f9 100644 --- a/common/strlist.c +++ b/common/strlist.c @@ -221,3 +221,13 @@ strlist_find (strlist_t haystack, const char *needle) return haystack; return NULL; } + +int +strlist_length (strlist_t list) +{ + int i; + for (i = 0; list; list = list->next) + i ++; + + return i; +} -- cgit v1.2.3