]>
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
35 struct pa_strlist
*next
;
39 struct pa_strlist
* pa_strlist_prepend(struct pa_strlist
*l
, const char *s
) {
42 n
= pa_xmalloc(sizeof(struct pa_strlist
));
43 n
->str
= pa_xstrdup(s
);
48 char *pa_strlist_tostring(struct 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 struct pa_strlist
* pa_strlist_remove(struct pa_strlist
*l
, const char *s
) {
64 struct pa_strlist
*ret
= l
, *prev
= NULL
;
68 if (!strcmp(l
->str
, s
)) {
69 struct pa_strlist
*n
= l
->next
;
91 void pa_strlist_free(struct pa_strlist
*l
) {
93 struct pa_strlist
*c
= l
;
101 struct pa_strlist
* pa_strlist_pop(struct pa_strlist
*l
, char **s
) {
102 struct pa_strlist
*r
;
116 struct pa_strlist
* pa_strlist_parse(const char *s
) {
117 struct pa_strlist
*head
= NULL
, *p
= NULL
;
118 const char *state
= NULL
;
121 while ((r
= pa_split_spaces(s
, &state
))) {
122 struct pa_strlist
*n
;
124 n
= pa_xmalloc(sizeof(struct pa_strlist
));