diff options
author | FreeArtMan <dos21h@gmail.com> | 2018-02-27 22:32:49 +0000 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2018-02-27 22:32:49 +0000 |
commit | 03bfeedc5f4c04c20764c8a9a58bd02604f27b2c (patch) | |
tree | 7ab09ac16649d80ca9e6397fc1b19aa8e184e2db /buf.h | |
parent | a8b9b15b4f02ce3c6c7eac0d9393c44cb3fc668d (diff) | |
download | libbuf-03bfeedc5f4c04c20764c8a9a58bd02604f27b2c.tar.gz libbuf-03bfeedc5f4c04c20764c8a9a58bd02604f27b2c.zip |
Created circular buffer
Diffstat (limited to 'buf.h')
-rw-r--r-- | buf.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 |