]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: Use array_foreach_elem() where possible
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 10 Feb 2021 19:20:25 +0000 (21:20 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 7 May 2021 10:09:35 +0000 (10:09 +0000)
src/config/config-filter.c
src/config/config-parser.c
src/config/doveconf.c

index 3d08e5e4e83575cda511435df9f49cc181b04a52..336380d5470c2443ab99209f3ee2e3ed1d0d2070 100644 (file)
@@ -176,10 +176,10 @@ config_filter_parser_cmp_rev(struct config_filter_parser *const *p1,
 
 static bool str_array_contains(ARRAY_TYPE(const_string) *arr, const char *str)
 {
-       const char *const *p;
+       const char *p;
 
-       array_foreach(arr, p) {
-               if (strcmp(*p, str) == 0)
+       array_foreach_elem(arr, p) {
+               if (strcmp(p, str) == 0)
                        return TRUE;
        }
        return FALSE;
index 0a0df795cfb6ca68d2019434bb84595a5ba387a5..9d3679621f65585a7cfb565ea1fb31e8934cc7f3 100644 (file)
@@ -233,11 +233,9 @@ static struct config_filter_parser *
 config_filter_parser_find(struct config_parser_context *ctx,
                          const struct config_filter *filter)
 {
-       struct config_filter_parser *const *parsers;
-
-       array_foreach(&ctx->all_parsers, parsers) {
-               struct config_filter_parser *parser = *parsers;
+       struct config_filter_parser *parser;
 
+       array_foreach_elem(&ctx->all_parsers, parser) {
                if (config_filters_equal(&parser->filter, filter))
                        return parser;
        }
index 5d903ec11436bcfc7a89121a418810f1181a5e4d..a32fedf223a14c00c5aa47971dfcbd6c17a1bd57 100644 (file)
@@ -487,8 +487,8 @@ config_dump_human_output(struct config_dump_human_context *ctx,
 
        /* flush output before writing errors */
        o_stream_uncork(output);
-       array_foreach(&ctx->errors, strings) {
-               i_error("%s", *strings);
+       array_foreach_elem(&ctx->errors, str) {
+               i_error("%s", str);
                ret = -1;
        }
        return ret;
@@ -615,7 +615,7 @@ config_dump_one(const struct config_filter *filter, bool hide_key,
                bool hide_passwords)
 {
        static struct config_dump_human_context *ctx;
-       const char *const *str;
+       const char *str;
        size_t len;
        bool dump_section = FALSE;
 
@@ -625,20 +625,20 @@ config_dump_one(const struct config_filter *filter, bool hide_key,
                return -1;
 
        len = strlen(setting_name_filter);
-       array_foreach(&ctx->strings, str) {
-               if (strncmp(*str, setting_name_filter, len) != 0)
+       array_foreach_elem(&ctx->strings, str) {
+               if (strncmp(str, setting_name_filter, len) != 0)
                        continue;
 
-               if ((*str)[len] == '=') {
+               if (str[len] == '=') {
                        if (hide_key)
-                               printf("%s\n", *str + len+1);
+                               printf("%s\n", str + len+1);
                        else {
                                printf("%s = %s\n", setting_name_filter,
-                                      *str + len+1);
+                                      str + len+1);
                        }
                        dump_section = FALSE;
                        break;
-               } else if ((*str)[len] == '/') {
+               } else if (str[len] == '/') {
                        dump_section = TRUE;
                }
        }