string-util: use GREEDY_ALLOC_ROUND_UP() in strextend()
This uses GREEDY_ALLOC_ROUND_UP() to grow the allocation size exponentially. This should speed allocation loops up a bit, given that we often call strextend() repeatedly in a loop on the same buffer.
This commit is contained in:
parent
c2bc710b24
commit
2a4e1fd0d4
|
@ -830,7 +830,7 @@ char *strextend_with_separator_internal(char **x, const char *separator, ...) {
|
|||
|
||||
need_separator = !isempty(*x);
|
||||
|
||||
nr = realloc(*x, l+1);
|
||||
nr = realloc(*x, GREEDY_ALLOC_ROUND_UP(l+1));
|
||||
if (!nr)
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue