]>
code.delx.au - pulseaudio/blob - polyp/strlist.c
4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
39 pa_strlist
* pa_strlist_prepend(pa_strlist
*l
, const char *s
) {
42 n
= pa_xmalloc(sizeof(pa_strlist
));
43 n
->str
= pa_xstrdup(s
);
48 char *pa_strlist_tostring(pa_strlist
*l
) {
53 for (; l
; l
= l
->next
) {
55 pa_strbuf_puts(b
, " ");
57 pa_strbuf_puts(b
, l
->str
);
60 return pa_strbuf_tostring_free(b
);
63 pa_strlist
* pa_strlist_remove(pa_strlist
*l
, const char *s
) {
64 pa_strlist
*ret
= l
, *prev
= NULL
;
68 if (!strcmp(l
->str
, s
)) {
69 pa_strlist
*n
= l
->next
;
91 void pa_strlist_free(pa_strlist
*l
) {
101 pa_strlist
* pa_strlist_pop(pa_strlist
*l
, char **s
) {
116 pa_strlist
* pa_strlist_parse(const char *s
) {
117 pa_strlist
*head
= NULL
, *p
= NULL
;
118 const char *state
= NULL
;
121 while ((r
= pa_split_spaces(s
, &state
))) {
124 n
= pa_xmalloc(sizeof(pa_strlist
));