mirror of
git://git.gnupg.org/gnupg.git
synced 2024-06-08 23:37:47 +02:00
common: Add new function strlist_length.
* common/strlist.c (strlist_length): New function. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
parent
819bba75aa
commit
8499c4f84a
|
@ -221,3 +221,13 @@ strlist_find (strlist_t haystack, const char *needle)
|
||||||
return haystack;
|
return haystack;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
strlist_length (strlist_t list)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; list; list = list->next)
|
||||||
|
i ++;
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ strlist_t strlist_last (strlist_t node);
|
||||||
char * strlist_pop (strlist_t *list);
|
char * strlist_pop (strlist_t *list);
|
||||||
|
|
||||||
strlist_t strlist_find (strlist_t haystack, const char *needle);
|
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)
|
#define FREE_STRLIST(a) do { free_strlist((a)); (a) = NULL ; } while(0)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user