From a8b9b15b4f02ce3c6c7eac0d9393c44cb3fc668d Mon Sep 17 00:00:00 2001 From: ZoRo Date: Mon, 15 Jan 2018 19:25:03 +0000 Subject: Initial commit --- buf.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 buf.h (limited to 'buf.h') diff --git a/buf.h b/buf.h new file mode 100644 index 0000000..99872ef --- /dev/null +++ b/buf.h @@ -0,0 +1,39 @@ +#ifndef __BUF_H +#define __BUF_H + +#include +#include +#include + +typedef struct bbuf { + int size; + int buf_size; + char *buf; +} bbuf; + +//operations on plain buffers also operations on bufer to buffer should be +//supoorted + +//create new buffer without content +bbuf* bbuf_new(int size); + +//set buffer value +int bbuf_set(bbuf *a, char *val, int size); +//get copy of buffer +bbuf *bbuf_copy(bbuf *buf); +//get buffer from buffer +int bbuf_get(bbuf *buf, char **val, int *size); +//resize buffer +int bbuf_realloc(bbuf *buf, int size); +//increase buffer for size +int bbuf_inc(bbuf *a, char *b, int size); +//decrease buffer for size +int bbuf_dec(bbuf *a, char *b, int size); +//free buffer +void bbuf_free(bbuf *buf); + +int bbuf_concat(bbuf *a, bbuf *b); + +void bbuf_free(bbuf *buf); + +#endif \ No newline at end of file -- cgit v1.2.3