aboutsummaryrefslogtreecommitdiffstats
path: root/buf.h
diff options
context:
space:
mode:
authorZoRo <dos21h@gmail.com>2016-12-15 19:17:14 +0000
committerZoRo <dos21h@gmail.com>2016-12-15 19:17:14 +0000
commita588aa017512d3cc70dde6627d1218020e755259 (patch)
treea070cd171d18f3efbaedb7cfa0f9d54e2bb3b362 /buf.h
downloadagni-a588aa017512d3cc70dde6627d1218020e755259.tar.gz
agni-a588aa017512d3cc70dde6627d1218020e755259.zip
Initial commit
Diffstat (limited to 'buf.h')
-rw-r--r--buf.h39
1 files changed, 39 insertions, 0 deletions
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 <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+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