diff options
author | Matt Johnston <matt@ucc.asn.au> | 2015-03-01 21:16:09 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2015-03-01 21:16:09 +0800 |
commit | f367273549350d99f476ad140b083d10a212d186 (patch) | |
tree | 761c2f8cf3f5003ecf1dd7ce484d41ab4e8c6c22 /buffer.h | |
parent | 91ef9b2fa99db1ddc3a12a393472fb3a387cf959 (diff) |
allocate buffer and data in a single allocation
--HG--
branch : nocircbuffer
Diffstat (limited to 'buffer.h')
-rw-r--r-- | buffer.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -29,7 +29,8 @@ #include "includes.h" struct buf { - + /* don't manipulate data member outside of buffer.c - it + is a pointer into the malloc holding buffer itself */ unsigned char * data; unsigned int len; /* the used size */ unsigned int pos; @@ -40,7 +41,8 @@ struct buf { typedef struct buf buffer; buffer * buf_new(unsigned int size); -void buf_resize(buffer *buf, unsigned int newsize); +/* Possibly returns a new buffer*, like realloc() */ +buffer * buf_resize(buffer *buf, unsigned int newsize); void buf_free(buffer* buf); void buf_burn(buffer* buf); buffer* buf_newcopy(buffer* buf); |