diff options
author | Lennart Poettering <lennart@poettering.net> | 2021-01-06 17:23:38 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2021-01-06 17:25:12 +0100 |
commit | 2a4e1fd0d498824f31292d8ba4e1e97c05eef0b8 (patch) | |
tree | cd18c3d6fadbb0d347bba91b41285a7f12eeb299 /src/basic/string-util.c | |
parent | string-util: imply NULL termination of strextend() argument list (diff) | |
download | systemd-2a4e1fd0d498824f31292d8ba4e1e97c05eef0b8.tar.xz systemd-2a4e1fd0d498824f31292d8ba4e1e97c05eef0b8.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/basic/string-util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c index 105952156d..be42d5c4f5 100644 --- a/src/basic/string-util.c +++ b/src/basic/string-util.c @@ -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; |