Switch audiod over to the buffer tree API.
[paraslash.git] / write.c
diff --git a/write.c b/write.c
index 4d06e80..c64ecb6 100644 (file)
--- a/write.c
+++ b/write.c
@@ -282,7 +282,7 @@ static int main_btr(struct sched *s)
 {
        int i, ret;
        struct check_wav_task_btr _cwt, *cwt = &_cwt;
-       struct writer_node **wns;
+       struct writer_node *wns;
 
        loglevel = get_loglevel_by_name(conf.loglevel_arg);
        sit.btrn = btr_new_node("stdin", NULL /* stdin has no parent */, NULL, NULL);
@@ -300,17 +300,17 @@ static int main_btr(struct sched *s)
        ret = -E_WRITE_SYNTAX;
        if (!conf.writer_given) {
                i = 0;
-               wns = para_malloc(sizeof(*wns));
-               wns[0] = setup_writer_node(NULL, cwt->btrn);
-               if (!wns[0])
+               wns = para_calloc(sizeof(*wns));
+               ret = setup_writer_node(NULL, cwt->btrn, wns);
+               if (ret < 0)
                        goto out;
                i = 1;
        } else {
-               wns = para_malloc(conf.writer_given * sizeof(*wns));
+               wns = para_calloc(conf.writer_given * sizeof(*wns));
                for (i = 0; i < conf.writer_given; i++) {
-                       wns[i] = setup_writer_node(conf.writer_arg[i],
-                               cwt->btrn);
-                       if (!wns[i])
+                       ret = setup_writer_node(conf.writer_arg[i],
+                               cwt->btrn, wns + i);
+                       if (ret < 0)
                                goto out;
                }
        }
@@ -320,7 +320,7 @@ static int main_btr(struct sched *s)
        ret = schedule(s);
 out:
        for (i--; i >= 0; i--) {
-               struct writer_node *wn = wns[i];
+               struct writer_node *wn = wns + i;
                struct writer *w = writers + wn->writer_num;
 
                w->close(wn);