summaryrefslogtreecommitdiff
path: root/buf.h
diff options
context:
space:
mode:
Diffstat (limited to 'buf.h')
-rw-r--r--buf.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/buf.h b/buf.h
index 99872ef..4db4f62 100644
--- a/buf.h
+++ b/buf.h
@@ -4,10 +4,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <ctype.h>
typedef struct bbuf {
- int size;
- int buf_size;
+ int size; //total size
+ int buf_size; //used size
char *buf;
} bbuf;
@@ -25,6 +26,8 @@ bbuf *bbuf_copy(bbuf *buf);
int bbuf_get(bbuf *buf, char **val, int *size);
//resize buffer
int bbuf_realloc(bbuf *buf, int size);
+//set to minimal size
+int bbuf_reduce(bbuf *buf);
//increase buffer for size
int bbuf_inc(bbuf *a, char *b, int size);
//decrease buffer for size
@@ -34,6 +37,10 @@ void bbuf_free(bbuf *buf);
int bbuf_concat(bbuf *a, bbuf *b);
+int bbuf_size(bbuf *a);
+
+int bbuf_print(bbuf *a);
+
void bbuf_free(bbuf *buf);
#endif \ No newline at end of file