summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-08-26 14:44:47 +0200
committerThomas Haller <thaller@redhat.com>2022-08-31 19:20:10 +0200
commit1326e428239c36f23359d25e8f57219f864f8a6f (patch)
tree934b86b770b0aa7ee2ded0f895d56142278ec04a
parentc5ec4ebd77be2302e63520d9151b75b972a5f764 (diff)
downloadNetworkManager-1326e428239c36f23359d25e8f57219f864f8a6f.tar.gz
glib-aux: first try stack allocated temporary buffer in nm_uuid_generate_from_strings()
Try to first use a stack allocated buffer for the temporary string. Only if the data is too large, NMStrBuf will automatically grow the buffer on the heap. In many cases, this buffer will be large enough, and we can avoid the heap allocation.
-rw-r--r--src/libnm-glib-aux/nm-uuid.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libnm-glib-aux/nm-uuid.c b/src/libnm-glib-aux/nm-uuid.c
index 53e8b78cd7..817279db6b 100644
--- a/src/libnm-glib-aux/nm-uuid.c
+++ b/src/libnm-glib-aux/nm-uuid.c
@@ -425,7 +425,7 @@ nm_uuid_generate_from_strings(const char *string1, ...)
return nm_uuid_generate_from_string_str(NULL, 0, NM_UUID_TYPE_VERSION3, &nm_uuid_ns_1);
{
- nm_auto_str_buf NMStrBuf str = NM_STR_BUF_INIT(NM_UTILS_GET_NEXT_REALLOC_SIZE_104, FALSE);
+ nm_auto_str_buf NMStrBuf str = NM_STR_BUF_INIT_A(NM_UTILS_GET_NEXT_REALLOC_SIZE_232, FALSE);
va_list args;
const char *s;