]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - filter.c
Merge topic branch t/play into pu
[paraslash.git] / filter.c
index 95438779e6aa0c206ec2b07225d3fae1d4a977a5..50447ec0cd2a165c974e4fea68e288e98a1713e3 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -120,15 +120,18 @@ int main(int argc, char *argv[])
                EMBRACE(.name = "stdin"));
        stdin_task_register(sit, &s);
 
-       fns = para_malloc(OPT_GIVEN(FILTER) * sizeof(*fns));
+       fns = arr_alloc(OPT_GIVEN(FILTER), sizeof(*fns));
        for (i = 0, parent = sit->btrn; i < OPT_GIVEN(FILTER); i++) {
                const char *fa = lls_string_val(i, OPT_RESULT(FILTER));
                const char *name;
                struct filter_node *fn;
                struct task_info ti;
 
-               fn = fns[i] = para_calloc(sizeof(*fn));
-               fn->filter_num = filter_setup(fa, &fn->conf, &filter_lpr);
+               fn = fns[i] = zalloc(sizeof(*fn));
+               ret = filter_setup(fa, &fn->conf, &filter_lpr);
+               if (ret < 0)
+                       goto teardown;
+               fn->filter_num = ret;
                name = filter_name(fn->filter_num);
                fn->lpr = filter_lpr;
                PARA_DEBUG_LOG("filter #%d: %s\n", i, name);
@@ -137,8 +140,8 @@ int main(int argc, char *argv[])
                        EMBRACE(.name = name, .parent = parent,
                        .handler = f->execute, .context = fn));
                ti.name = name;
-               ti.pre_select = f->pre_select;
-               ti.post_select = f->post_select;
+               ti.pre_monitor = f->pre_monitor;
+               ti.post_monitor = f->post_monitor;
                ti.context = fn;
                if (f->open)
                        f->open(fn);
@@ -153,6 +156,7 @@ int main(int argc, char *argv[])
        btr_log_tree(sit->btrn, LL_INFO);
        ret = schedule(&s);
        sched_shutdown(&s);
+teardown:
        for (i--; i >= 0; i--) {
                struct filter_node *fn = fns[i];