*
* This is a quite expensive operation.
*
- * \return The number of buffers that have been merged (zero, one or two).
+ * \return The number of buffers that have been available (zero, one or two).
*/
int btr_merge(struct btr_node *btrn)
{
para_list_add(&br->node, &btrn->input_queue);
return 2;
}
+
+void btr_merge_to(struct btr_node *btrn, size_t dest_size)
+{
+ for (;;) {
+ char *buf;
+ size_t len = btr_next_buffer(btrn, &buf);
+ if (len >= dest_size)
+ return;
+ if (btr_merge(btrn) < 2)
+ return;
+ }
+}
void btr_pushdown(struct btr_node *btrn);
void *btr_context(struct btr_node *btrn);
int btr_merge(struct btr_node *btrn);
+void btr_merge_to(struct btr_node *btrn, size_t dest_size);