On 2/21/22 10:07 PM, jaillet...@apache.org wrote:
> Author: jailletc36
> Date: Mon Feb 21 21:07:35 2022
> New Revision: 1898286
> 
> URL: http://svn.apache.org/viewvc?rev=1898286&view=rev
> Log:
> There is no point in calling ap_varbuf_grow() here, it is already
> called from within ap_varbuf_strmemcat().
> 
> Moreover, 2nd parameter should be the minimum total new length, not
> the amount of the growth. So this call is likely to be a no-op.

I agree that the current usage of ap_varbuf_grow is wrong as it should be the 
complete length and not the growth.
OTOH the idea seems to be to avoid too much reallocations and memcpys here.
We could precalculate the length, but I am not sure if this creates more 
overhead than needed here. If we precalculate the length
the question is also if the ap_varbuf_ is still the best api for this or we 
should switch to apr_pstrcatv instead to avoid
having to strlen all elements of the list twice. Of course this costs a little 
more memory for the struct iovec array.

Regards

RĂ¼diger


Reply via email to