diff options
author | Lennart Poettering <lennart@poettering.net> | 2007-10-29 20:30:15 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2007-10-29 20:30:15 +0000 |
commit | cc883852bc3c71e2c5c04177a6e4d29af18e2045 (patch) | |
tree | 5df8f4bf51ebdd6fb9b905bd779312e6778eb078 /src/pulsecore | |
parent | 87be85618ce0bca05a4776bf7154c34b010fb6e9 (diff) |
add new API pa_strlist_reverse()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1984 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/pulsecore')
-rw-r--r-- | src/pulsecore/strlist.c | 15 | ||||
-rw-r--r-- | src/pulsecore/strlist.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/pulsecore/strlist.c b/src/pulsecore/strlist.c index 792af0ff..ac83f6b1 100644 --- a/src/pulsecore/strlist.c +++ b/src/pulsecore/strlist.c @@ -146,3 +146,18 @@ pa_strlist* pa_strlist_parse(const char *s) { return head; } + +pa_strlist *pa_strlist_reverse(pa_strlist *l) { + pa_strlist *r = NULL; + + while (l) { + pa_strlist *n; + + n = l->next; + l->next = r; + r = l; + l = n; + } + + return r; +} diff --git a/src/pulsecore/strlist.h b/src/pulsecore/strlist.h index 96ad47e2..6e6e2d4a 100644 --- a/src/pulsecore/strlist.h +++ b/src/pulsecore/strlist.h @@ -46,4 +46,7 @@ pa_strlist* pa_strlist_pop(pa_strlist *l, char **s); /* Parse a whitespace separated server list */ pa_strlist* pa_strlist_parse(const char *s); +/* Reverse string list */ +pa_strlist *pa_strlist_reverse(pa_strlist *l); + #endif |