#470 (comment):
Check dynbuf.c, it's the same logic but dynbuf uses elem_size = 1. I would suggest implementing bf_vector_take to take ownership of the data (so bf_vector would re-allocate memory on the next add). Then (in a subsequent commit), replace bf_dynbuf with bf_vector.