From 34fee5954159a9598110316ae79b64f0e408b423 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 28 Dec 2009 21:33:29 +0100 Subject: [PATCH] Add buffer_tree.h. --- buffer_tree.c | 7 ++++--- buffer_tree.h | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 buffer_tree.h diff --git a/buffer_tree.c b/buffer_tree.c index 9a59fff9..b3aea0e4 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -4,7 +4,7 @@ #include "para.h" #include "list.h" #include "string.h" -//#include "buffer_tree.h" +#include "buffer_tree.h" struct btr_buffer { @@ -77,7 +77,7 @@ static struct btr_buffer *new_btrb(char *buf, size_t size) /* * Deallocate the reference, release the resources if refcount drops to zero. */ -void btr_drop_buffer_reference(struct btr_buffer_reference *br) +static void btr_drop_buffer_reference(struct btr_buffer_reference *br) { struct btr_buffer *btrb = br->btrb; @@ -111,7 +111,7 @@ void btr_add_output(char *buf, size_t size, struct btr_node *btrn) add_btrb_to_children(btrb, btrn); } -void btr_pushdown_br(struct btr_buffer_reference *br, struct btr_node *btrn) +static void btr_pushdown_br(struct btr_buffer_reference *br, struct btr_node *btrn) { add_btrb_to_children(br->btrb, btrn); btr_drop_buffer_reference(br); @@ -150,6 +150,7 @@ struct btr_buffer_reference *btr_next_br(struct btr_node *btrn) return list_first_entry(&btrn->input_queue, struct btr_buffer_reference, node); } + static inline size_t br_available_bytes(struct btr_buffer_reference *br) { return br->btrb->size - br->consumed; diff --git a/buffer_tree.h b/buffer_tree.h new file mode 100644 index 00000000..18b9e8a2 --- /dev/null +++ b/buffer_tree.h @@ -0,0 +1,6 @@ + +struct btr_node; + +struct btr_node *btr_new_node(char *name, struct btr_node *parent); +void btr_add_output(char *buf, size_t size, struct btr_node *btrn); +bool btr_is_leaf_node(struct btr_node *btrn); -- 2.39.5