1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

common: Add new function strlist_rev.

* common/strlist.c (strlist_rev): New function.
* common/t-strlist.c: New file.
* common/Makefile.am (common_sources): Add strlist.c and strlist.h.
(module_tests): Add t-strlist.
(t_strlist_LDADD): New variable.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
Neal H. Walfield 2015-11-06 10:51:35 +01:00
parent 23e163473f
commit f38bac8883
4 changed files with 106 additions and 2 deletions

View file

@ -231,3 +231,22 @@ strlist_length (strlist_t list)
return i;
}
/* Reverse the list *LIST in place. */
strlist_t
strlist_rev (strlist_t *list)
{
strlist_t l = *list;
strlist_t lrev = NULL;
while (l)
{
strlist_t tail = l->next;
l->next = lrev;
lrev = l;
l = tail;
}
*list = lrev;
return lrev;
}