diff --git a/src/buffer.c b/src/buffer.c index e8c96a3..4a27e57 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -3,6 +3,7 @@ #include #include #include "ucore/buffer.h" +#include "ucore/utils.h" GBuf* uc_new_gbuf(size_t initsz) @@ -48,7 +49,7 @@ uc_gbuf_append(GBuf *buf,const void *data,size_t len) unsigned char *gbuf; if (buf->len - buf->used < len) - if (uc_gbuf_grow(buf, len + len/2)) + if (uc_gbuf_grow(buf, len + UC_MAX(UC_MIN(8U,len/2),256U))) return -1; gbuf = buf->buf;