summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/core-util.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2009-10-08 14:19:47 +0800
committerDaniel Mack <daniel@caiaq.de>2009-10-08 14:19:47 +0800
commit0b388bff522f689fdb4d98529a39f3701db57c08 (patch)
tree837b4fb0993078a708dfddb5801220e44a711d32 /src/pulsecore/core-util.c
parent94aa9097f4ded68623160d754a4bf2632b8efc79 (diff)
parent8ec304d2d1e956cc3f5f35437ac4fe580b36f004 (diff)
Merge branch 'master' of git://0pointer.de/pulseaudio
Diffstat (limited to 'src/pulsecore/core-util.c')
-rw-r--r--src/pulsecore/core-util.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index 8e98e857..27e09cbc 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -2678,6 +2678,28 @@ char *pa_replace(const char*s, const char*a, const char *b) {
return pa_strbuf_tostring_free(sb);
}
+char *pa_escape(const char *p, const char *chars) {
+ const char *s;
+ const char *c;
+ pa_strbuf *buf = pa_strbuf_new();
+
+ for (s = p; *s; ++s) {
+ if (*s == '\\')
+ pa_strbuf_putc(buf, '\\');
+ else if (chars) {
+ for (c = chars; *c; ++c) {
+ if (*s == *c) {
+ pa_strbuf_putc(buf, '\\');
+ break;
+ }
+ }
+ }
+ pa_strbuf_putc(buf, *s);
+ }
+
+ return pa_strbuf_tostring_free(buf);
+}
+
char *pa_unescape(char *p) {
char *s, *d;
pa_bool_t escaped = FALSE;