]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Replace some settings_parse_line() calls with settings_parse_keyvalue()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 14 Nov 2016 23:41:38 +0000 (00:41 +0100)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 18 Nov 2016 11:55:49 +0000 (13:55 +0200)
src/config/config-parser.c
src/doveadm/doveadm-dsync.c
src/lib-storage/mail-storage-service.c

index c6e04256c482c5c4d946d128fd37400695edc3e2..7463c224e330c6861e73571e6c498a41b823612c 100644 (file)
@@ -84,10 +84,8 @@ static int config_add_type(struct setting_parser_context *parser,
                str_append_c(str, SETTINGS_SEPARATOR);
                str_append(str, info_type_name_find(info));
        }
-       str_append_c(str, '=');
-       str_append(str, section_name);
 
-       ret = settings_parse_line(parser, str_c(str));
+       ret = settings_parse_keyvalue(parser, str_c(str), section_name);
        i_assert(ret > 0);
        return 0;
 }
index 48648db17c761b5fa053acdb2ff1e938ba366f64..a19596b4005f71488c109c43937b72b97db0aaf6 100644 (file)
@@ -338,7 +338,7 @@ cmd_dsync_run_local(struct dsync_cmd_context *ctx, struct mail_user *user,
        struct dsync_brain *brain2;
        struct mail_user *user2;
        struct setting_parser_context *set_parser;
-       const char *set_line, *location;
+       const char *location;
        bool brain1_running, brain2_running, changed1, changed2;
        int ret;
 
@@ -356,8 +356,7 @@ cmd_dsync_run_local(struct dsync_cmd_context *ctx, struct mail_user *user,
        /* update mail_location and create another user for the
           second location. */
        set_parser = mail_storage_service_user_get_settings_parser(ctx->ctx.cur_service_user);
-       set_line = t_strconcat("mail_location=", location, NULL);
-       if (settings_parse_line(set_parser, set_line) < 0)
+       if (settings_parse_keyvalue(set_parser, "mail_location", location) < 0)
                i_unreached();
        ret = mail_storage_service_next(ctx->ctx.storage_service,
                                        ctx->ctx.cur_service_user, &user2);
index bedb33af9834d5476dcf0610c22131b9286c6f56..4a65f5759cc054171aef031dfd878b09e1831b26 100644 (file)
@@ -113,7 +113,6 @@ static void set_keyval(struct mail_storage_service_ctx *ctx,
                       const char *key, const char *value)
 {
        struct setting_parser_context *set_parser = user->set_parser;
-       const char *str;
 
        if (master_service_set_has_config_override(ctx->service, key)) {
                /* this setting was already overridden with -o parameter */
@@ -125,9 +124,8 @@ static void set_keyval(struct mail_storage_service_ctx *ctx,
                return;
        }
 
-       str = t_strconcat(key, "=", value, NULL);
-       if (settings_parse_line(set_parser, str) < 0) {
-               i_fatal("Invalid userdb input '%s': %s", str,
+       if (settings_parse_keyvalue(set_parser, key, value) < 0) {
+               i_fatal("Invalid userdb input %s=%s: %s", key, value,
                        settings_parser_get_error(set_parser));
        }
 }