Commit 4fa72446 authored by Max Kellermann's avatar Max Kellermann

util/fifo_buffer: add method _init()

parent 1e2018ce
...@@ -58,6 +58,14 @@ fifo_buffer_new(size_t size) ...@@ -58,6 +58,14 @@ fifo_buffer_new(size_t size)
return buffer; return buffer;
} }
void
fifo_buffer_init(struct fifo_buffer *buffer, size_t size)
{
buffer->size = size - (sizeof(*buffer) - sizeof(buffer->buffer));
buffer->start = 0;
buffer->end = 0;
}
static void static void
fifo_buffer_move(struct fifo_buffer *buffer); fifo_buffer_move(struct fifo_buffer *buffer);
......
...@@ -60,6 +60,9 @@ extern "C" { ...@@ -60,6 +60,9 @@ extern "C" {
struct fifo_buffer * struct fifo_buffer *
fifo_buffer_new(size_t size); fifo_buffer_new(size_t size);
void
fifo_buffer_init(struct fifo_buffer *buffer, size_t size);
/** /**
* Change the capacity of the #fifo_buffer, while preserving existing * Change the capacity of the #fifo_buffer, while preserving existing
* data. * data.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment