diff options
author | Pierre Ossman <ossman@cendio.se> | 2006-02-16 19:19:58 +0000 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2006-02-16 19:19:58 +0000 |
commit | e205b25d65ccb380fa158711e24d55b6de5d9bc1 (patch) | |
tree | 470b4ced153c9ff18b8e35deb05c7a95efc838fc /polyp/strlist.c | |
parent | 5b881e62282f26b353635120935d114e0c7c3f3c (diff) |
Reorganised the source tree. We now have src/ with a couple of subdirs:
* daemon/ - Contains the files specific to the polypaudio daemon.
* modules/ - All loadable modules.
* polyp/ - Files that are part of the public, application interface or
are only used in libpolyp.
* polypcore/ - All other shared files.
* tests/ - Test programs.
* utils/ - Utility programs.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@487 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/strlist.c')
-rw-r--r-- | polyp/strlist.c | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/polyp/strlist.c b/polyp/strlist.c deleted file mode 100644 index 09eb0c8a..00000000 --- a/polyp/strlist.c +++ /dev/null @@ -1,137 +0,0 @@ -/* $Id$ */ - -/*** - This file is part of polypaudio. - - polypaudio is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published - by the Free Software Foundation; either version 2 of the License, - or (at your option) any later version. - - polypaudio is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with polypaudio; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - USA. -***/ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <assert.h> - -#include "strlist.h" -#include "xmalloc.h" -#include "strbuf.h" -#include "util.h" - -struct pa_strlist { - pa_strlist *next; - char *str; -}; - -pa_strlist* pa_strlist_prepend(pa_strlist *l, const char *s) { - pa_strlist *n; - assert(s); - n = pa_xmalloc(sizeof(pa_strlist)); - n->str = pa_xstrdup(s); - n->next = l; - return n; -} - -char *pa_strlist_tostring(pa_strlist *l) { - int first = 1; - pa_strbuf *b; - - b = pa_strbuf_new(); - for (; l; l = l->next) { - if (!first) - pa_strbuf_puts(b, " "); - first = 0; - pa_strbuf_puts(b, l->str); - } - - return pa_strbuf_tostring_free(b); -} - -pa_strlist* pa_strlist_remove(pa_strlist *l, const char *s) { - pa_strlist *ret = l, *prev = NULL; - assert(l && s); - - while (l) { - if (!strcmp(l->str, s)) { - pa_strlist *n = l->next; - - if (!prev) { - assert(ret == l); - ret = n; - } else - prev->next = n; - - pa_xfree(l->str); - pa_xfree(l); - - l = n; - - } else { - prev = l; - l = l->next; - } - } - - return ret; -} - -void pa_strlist_free(pa_strlist *l) { - while (l) { - pa_strlist *c = l; - l = l->next; - - pa_xfree(c->str); - pa_xfree(c); - } -} - -pa_strlist* pa_strlist_pop(pa_strlist *l, char **s) { - pa_strlist *r; - assert(s); - - if (!l) { - *s = NULL; - return NULL; - } - - *s = l->str; - r = l->next; - pa_xfree(l); - return r; -} - -pa_strlist* pa_strlist_parse(const char *s) { - pa_strlist *head = NULL, *p = NULL; - const char *state = NULL; - char *r; - - while ((r = pa_split_spaces(s, &state))) { - pa_strlist *n; - - n = pa_xmalloc(sizeof(pa_strlist)); - n->str = r; - n->next = NULL; - - if (p) - p->next = n; - else - head = n; - - p = n; - } - - return head; -} |