summaryrefslogtreecommitdiffstats
path: root/polyp/module-match.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-09-28 22:47:48 +0000
committerLennart Poettering <lennart@poettering.net>2004-09-28 22:47:48 +0000
commit6f59ae1763ee48f27448a7de9d635f61886052e1 (patch)
treee83ab47226b6c716c200e9fa40f44668997eb642 /polyp/module-match.c
parent450ad85b35bd600ed020f7ec119d51e7e7bc01a4 (diff)
Add module-tunnel
add proper locking when autospawning a daemon git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@245 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/module-match.c')
-rw-r--r--polyp/module-match.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/polyp/module-match.c b/polyp/module-match.c
index 964ff2fd..380c6011 100644
--- a/polyp/module-match.c
+++ b/polyp/module-match.c
@@ -164,7 +164,6 @@ static void callback(struct pa_core *c, enum pa_subscription_event_type t, uint3
int pa__init(struct pa_core *c, struct pa_module*m) {
struct pa_modargs *ma = NULL;
- int ret = -1;
const char *table_file;
struct userdata *u;
assert(c && m);
@@ -172,25 +171,28 @@ int pa__init(struct pa_core *c, struct pa_module*m) {
if (!(ma = pa_modargs_new(m->argument, valid_modargs)) ||
!(table_file = pa_modargs_get_value(ma, "table", NULL))) {
pa_log(__FILE__": Failed to parse module arguments\n");
- goto finish;
+ goto fail;
}
u = pa_xmalloc(sizeof(struct userdata));
u->rules = NULL;
u->subscription = NULL;
+ m->userdata = u;
if (load_rules(u, table_file) < 0)
- goto finish;
+ goto fail;
u->subscription = pa_subscription_new(c, PA_SUBSCRIPTION_MASK_SINK_INPUT, callback, u);
-
- ret = 0;
-finish:
+ pa_modargs_free(ma);
+ return 0;
+
+fail:
+ pa__done(c, m);
+
if (ma)
pa_modargs_free(ma);
-
- return ret;
+ return -1;
}
void pa__done(struct pa_core *c, struct pa_module*m) {