From: Aki Tuomi Date: Wed, 30 Jul 2025 06:42:20 +0000 (+0300) Subject: auth: auth-cache - Refactor auth_cache_parse_key_and_fields() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c45ce2c073c9439a9d6366016cb4d41059d737f0;p=thirdparty%2Fdovecot%2Fcore.git auth: auth-cache - Refactor auth_cache_parse_key_and_fields() Call auth_cache_parse_key_exclude() at the function end, simplifies next commit. --- diff --git a/src/auth/auth-cache.c b/src/auth/auth-cache.c index 360ad8b3f6..3ccd45ff4b 100644 --- a/src/auth/auth-cache.c +++ b/src/auth/auth-cache.c @@ -129,20 +129,18 @@ char *auth_cache_parse_key_and_fields(pool_t pool, const char *query, const ARRAY_TYPE(const_string) *fields, const char *exclude_driver) { - if (array_is_empty(fields)) - return auth_cache_parse_key_exclude(pool, query, exclude_driver); - - string_t *full_query = t_str_new(128); - str_append(full_query, query); - - unsigned int i, count; - const char *const *str = array_get(fields, &count); - for (i = 0; i < count; i += 2) { - str_append_c(full_query, '\t'); - str_append(full_query, str[i + 1]); + if (!array_is_empty(fields)) { + unsigned int i, count; + const char *const *str = array_get(fields, &count); + string_t *full_query = t_str_new(128); + str_append(full_query, query); + for (i = 0; i < count; i += 2) { + str_append_c(full_query, '\t'); + str_append(full_query, str[i + 1]); + } + query = str_c(full_query); } - return auth_cache_parse_key_exclude(pool, str_c(full_query), - exclude_driver); + return auth_cache_parse_key_exclude(pool, query, exclude_driver); } static void