aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/strlist.c10
-rw-r--r--common/strlist.h1
2 files changed, 11 insertions, 0 deletions
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;
+}
diff --git a/common/strlist.h b/common/strlist.h
index 5c17ce69f..fccce8704 100644
--- a/common/strlist.h
+++ b/common/strlist.h
@@ -56,6 +56,7 @@ strlist_t strlist_last (strlist_t node);
char * strlist_pop (strlist_t *list);
strlist_t strlist_find (strlist_t haystack, const char *needle);
+int strlist_length (strlist_t list);
#define FREE_STRLIST(a) do { free_strlist((a)); (a) = NULL ; } while(0)