From: uwezkhan06 Date: Tue, 21 Apr 2026 20:27:38 +0000 (+0000) Subject: lib: Use p_realloc_type() where possible X-Git-Tag: 2.4.4~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc85822552aaf6d0ec0d6fceddf42c5ee2115cbb;p=thirdparty%2Fdovecot%2Fcore.git lib: Use p_realloc_type() where possible --- diff --git a/src/lib/strescape.c b/src/lib/strescape.c index ded3d4bf17..b62a5c779a 100644 --- a/src/lib/strescape.c +++ b/src/lib/strescape.c @@ -320,12 +320,8 @@ static char **p_strsplit_tabescaped_inplace(pool_t pool, char *data) } if (count+1 >= alloc_count) { new_alloc_count = nearest_power(alloc_count+1); - size_t old_size = - MALLOC_MULTIPLY(sizeof(char *), alloc_count); - size_t new_size = - MALLOC_MULTIPLY(sizeof(char *), new_alloc_count); - array = p_realloc(pool, array, - old_size, new_size); + array = p_realloc_type(pool, array, char *, + alloc_count, new_alloc_count); alloc_count = new_alloc_count; } *data++ = '\0'; diff --git a/src/lib/strfuncs.c b/src/lib/strfuncs.c index 2b346f61ec..7ff1071018 100644 --- a/src/lib/strfuncs.c +++ b/src/lib/strfuncs.c @@ -758,12 +758,8 @@ split_str_slow(pool_t pool, const char *data, const char *separators, bool space /* separator found */ if (count+1 >= alloc_count) { new_alloc_count = nearest_power(alloc_count+1); - size_t old_size = - MALLOC_MULTIPLY(sizeof(char *), alloc_count); - size_t new_size = - MALLOC_MULTIPLY(sizeof(char *), new_alloc_count); - array = p_realloc(pool, array, - old_size, new_size); + array = p_realloc_type(pool, array, char *, + alloc_count, new_alloc_count); alloc_count = new_alloc_count; } @@ -809,12 +805,8 @@ split_str_fast(pool_t pool, const char *data, char sep) /* separator found */ if (count+1 >= alloc_count) { new_alloc_count = nearest_power(alloc_count+1); - size_t old_size = - MALLOC_MULTIPLY(sizeof(char *), alloc_count); - size_t new_size = - MALLOC_MULTIPLY(sizeof(char *), new_alloc_count); - array = p_realloc(pool, array, - old_size, new_size); + array = p_realloc_type(pool, array, char *, + alloc_count, new_alloc_count); alloc_count = new_alloc_count; } *str++ = '\0';