From: Timo Sirainen Date: Mon, 14 Nov 2016 23:41:38 +0000 (+0100) Subject: global: Replace some settings_parse_line() calls with settings_parse_keyvalue() X-Git-Tag: 2.2.27~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f148562cb6cf3ee973404de49011c023d124ddde;p=thirdparty%2Fdovecot%2Fcore.git global: Replace some settings_parse_line() calls with settings_parse_keyvalue() --- diff --git a/src/config/config-parser.c b/src/config/config-parser.c index c6e04256c4..7463c224e3 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -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; } diff --git a/src/doveadm/doveadm-dsync.c b/src/doveadm/doveadm-dsync.c index 48648db17c..a19596b400 100644 --- a/src/doveadm/doveadm-dsync.c +++ b/src/doveadm/doveadm-dsync.c @@ -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); diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index bedb33af98..4a65f5759c 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -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)); } }