Some buffer code like _buffer_linear_realloc and _buffer_vector_realloc is very similar. Factor this common code out into a generic function that the linear and vector type can use.
When factoring out the code, we need to consider that linear and vector variants of the buffer use different units and different meaning of 'size' - in linear, the size is multiple of byte while in vector, the 'size' is the number of vector elements.
Some buffer code like
_buffer_linear_reallocand_buffer_vector_reallocis very similar. Factor this common code out into a generic function that the linear and vector type can use.When factoring out the code, we need to consider that linear and vector variants of the buffer use different units and different meaning of 'size' - in linear, the size is multiple of byte while in vector, the 'size' is the number of vector elements.