]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - buffer_tree.c
amp filter improvements.
[paraslash.git] / buffer_tree.c
index 5d8e33fc17748dc1347af4f1ec57f15a8b662741..c826e8fa26a97c9036595ddf188bb984a7b4ec4e 100644 (file)
@@ -119,6 +119,11 @@ void btr_add_output(char *buf, size_t size, struct btr_node *btrn)
 {
        struct btr_buffer *btrb;
 
+       assert(size != 0);
+       if (list_empty(&btrn->children)) {
+               free(buf);
+               return;
+       }
        btrb = new_btrb(buf, size);
        add_btrb_to_children(btrb, btrn, 0);
 }
@@ -137,6 +142,17 @@ void btr_pushdown(struct btr_node *btrn)
                btr_pushdown_br(br, btrn);
 }
 
+int btr_pushdown_one(struct btr_node *btrn)
+{
+       struct btr_buffer_reference *br;
+
+       if (list_empty(&btrn->input_queue))
+               return 0;
+       br = list_first_entry(&btrn->input_queue, struct btr_buffer_reference, node);
+       btr_pushdown_br(br, btrn);
+       return 1;
+}
+
 /* Return true if this node has no children. */
 bool btr_no_children(struct btr_node *btrn)
 {