#include "alloc.h"
#include "arena.h"
#include "darray.h"
+#include "growbuf.h"
/*----- Magic numbers -----------------------------------------------------*/
* two which is big enough, starting at double the current size.
*/
- nsz = v ? b->sz + b->off : (DA_INITSZ >> 1);
- do nsz <<= 1; while (nsz < rq);
+ nsz = b->sz + b->off;
+ GROWBUF_SIZE(size_t, nsz, rq, DA_INITSZ, sz);
/* --- Reallocate the block --- *
*
* two which is big enough, starting at double the current size.
*/
- nsz = v ? b->sz + b->off : (DA_INITSZ >> 1);
- do nsz <<= 1; while (nsz < rq);
+ nsz = b->sz + b->off;
+ GROWBUF_SIZE(size_t, nsz, rq, DA_INITSZ, sz);
/* --- Reallocate the block --- *
*