]>
code.delx.au - pulseaudio/blob - src/polypcore/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
29 #include <polypcore/xmalloc.h>
30 #include <polypcore/strbuf.h>
31 #include <polypcore/util.h>
40 pa_strlist
* pa_strlist_prepend(pa_strlist
*l
, const char *s
) {
43 n
= pa_xmalloc(sizeof(pa_strlist
));
44 n
->str
= pa_xstrdup(s
);
49 char *pa_strlist_tostring(pa_strlist
*l
) {
54 for (; l
; l
= l
->next
) {
56 pa_strbuf_puts(b
, " ");
58 pa_strbuf_puts(b
, l
->str
);
61 return pa_strbuf_tostring_free(b
);
64 pa_strlist
* pa_strlist_remove(pa_strlist
*l
, const char *s
) {
65 pa_strlist
*ret
= l
, *prev
= NULL
;
69 if (!strcmp(l
->str
, s
)) {
70 pa_strlist
*n
= l
->next
;
92 void pa_strlist_free(pa_strlist
*l
) {
102 pa_strlist
* pa_strlist_pop(pa_strlist
*l
, char **s
) {
117 pa_strlist
* pa_strlist_parse(const char *s
) {
118 pa_strlist
*head
= NULL
, *p
= NULL
;
119 const char *state
= NULL
;
122 while ((r
= pa_split_spaces(s
, &state
))) {
125 n
= pa_xmalloc(sizeof(pa_strlist
));