diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | include/buffer.h | 2 | ||||
-rw-r--r-- | src/buffer.c | 6 |
3 files changed, 9 insertions, 0 deletions
@@ -75,6 +75,7 @@ o always close stdin - even in non-daemon mode, it is of no use o chdir("/") to release the cwd inode o ignore setsid() failure, because there is only one possible and o fix harmless error condition +o add buffer_destroy() to buffer.c version 0.9.5 (2007/07/29) ------------------------------ diff --git a/include/buffer.h b/include/buffer.h index aa753b4..0d52e72 100644 --- a/include/buffer.h +++ b/include/buffer.h @@ -8,6 +8,8 @@ struct buffer { }; struct buffer *buffer_create(unsigned int size); +void buffer_destroy(struct buffer *b); + int buffer_add(struct buffer *b, void *data, unsigned int size); void buffer_flush(struct buffer *b, void (*cb)(void *buffer_data, diff --git a/src/buffer.c b/src/buffer.c index 79266a7..adde81c 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -41,6 +41,12 @@ struct buffer *buffer_create(unsigned int size) return b; } +void buffer_destroy(struct buffer *b) +{ + free(b->data); + free(b); +} + int buffer_add(struct buffer *b, void *data, unsigned int size) { if (b->size - b->cur_size < size) { |