4 This file is part of PulseAudio.
6 Copyright 2004-2006 Lennart Poettering
8 PulseAudio is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published
10 by the Free Software Foundation; either version 2 of the License,
11 or (at your option) any later version.
13 PulseAudio is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with PulseAudio; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
31 #include <pulse/xmalloc.h>
33 #include <pulsecore/strbuf.h>
34 #include <pulsecore/core-util.h>
43 pa_strlist* pa_strlist_prepend(pa_strlist *l, const char *s) {
46 n = pa_xmalloc(sizeof(pa_strlist));
47 n->str = pa_xstrdup(s);
52 char *pa_strlist_tostring(pa_strlist *l) {
57 for (; l; l = l->next) {
59 pa_strbuf_puts(b, " ");
61 pa_strbuf_puts(b, l->str);
64 return pa_strbuf_tostring_free(b);
67 pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s) {
68 pa_strlist *ret = l, *prev = NULL;
72 if (!strcmp(l->str, s)) {
73 pa_strlist *n = l->next;
95 void pa_strlist_free(pa_strlist *l) {
105 pa_strlist* pa_strlist_pop(pa_strlist *l, char **s) {
120 pa_strlist* pa_strlist_parse(const char *s) {
121 pa_strlist *head = NULL, *p = NULL;
122 const char *state = NULL;
125 while ((r = pa_split_spaces(s, &state))) {
128 n = pa_xmalloc(sizeof(pa_strlist));