diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 11:49:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-02-07 12:42:05 +0000 |
commit | 2e85f9325a797977eea9dfea0a925775ddd211d9 (patch) | |
tree | 452c7f30d62fca5755f659b99e4e53c7b03afc21 /libnetdata/circular_buffer/circular_buffer.h | |
parent | Releasing debian version 1.19.0-4. (diff) | |
download | netdata-2e85f9325a797977eea9dfea0a925775ddd211d9.tar.xz netdata-2e85f9325a797977eea9dfea0a925775ddd211d9.zip |
Merging upstream version 1.29.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/circular_buffer/circular_buffer.h')
-rw-r--r-- | libnetdata/circular_buffer/circular_buffer.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libnetdata/circular_buffer/circular_buffer.h b/libnetdata/circular_buffer/circular_buffer.h new file mode 100644 index 000000000..ba37e0ebf --- /dev/null +++ b/libnetdata/circular_buffer/circular_buffer.h @@ -0,0 +1,16 @@ +#ifndef CIRCULAR_BUFFER_H +#define CIRCULAR_BUFFER_H 1 + +#include <string.h> + +struct circular_buffer { + size_t size, write, read, max_size; + char *data; +}; + +extern struct circular_buffer *cbuffer_new(size_t initial, size_t max); +extern void cbuffer_free(struct circular_buffer *buf); +extern int cbuffer_add_unsafe(struct circular_buffer *buf, const char *d, size_t d_len); +extern void cbuffer_remove_unsafe(struct circular_buffer *buf, size_t num); +extern size_t cbuffer_next_unsafe(struct circular_buffer *buf, char **start); +#endif |