From: Karl Fleischmann Date: Wed, 26 Oct 2022 15:06:02 +0000 (+0200) Subject: global: Replace settings_get_bool() with str_parse_get_bool() in project X-Git-Tag: 2.4.0~3398 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=564d29f496a7ff92d5ed555b510523a659c80048;p=thirdparty%2Fdovecot%2Fcore.git global: Replace settings_get_bool() with str_parse_get_bool() in project --- diff --git a/src/config/old-set-parser.c b/src/config/old-set-parser.c index 859cd81628..115bb2ca28 100644 --- a/src/config/old-set-parser.c +++ b/src/config/old-set-parser.c @@ -2,6 +2,7 @@ #include "lib.h" #include "str.h" +#include "str-parse.h" #include "settings-parser.h" #include "config-parser-private.h" #include "old-set-parser.h" @@ -295,7 +296,7 @@ old_settings_handle_root(struct config_parser_context *ctx, if (strcmp(key, "auth_debug") == 0) { const char *error ATTR_UNUSED; bool auth_debug; - if (settings_get_bool(value, &auth_debug, &error) == 0 && + if (str_parse_get_bool(value, &auth_debug, &error) == 0 && auth_debug) ctx->old->post_auth_debug = auth_debug; obsolete(ctx, "%s will be removed in a future version%s", @@ -317,7 +318,7 @@ old_settings_handle_root(struct config_parser_context *ctx, if (strcmp(key, "disable_plaintext_auth") == 0) { const char *error; bool b; - if (settings_get_bool(value, &b, &error) < 0) + if (str_parse_get_bool(value, &b, &error) < 0) i_fatal("%s has bad value '%s': %s", key, value, error); obsolete(ctx, "%s = %s has been replaced with auth_allow_cleartext = %s", key, value, b ? "no" : "yes"); diff --git a/src/lib-settings/settings-parser.c b/src/lib-settings/settings-parser.c index 7f19bed591..8013c6e0cf 100644 --- a/src/lib-settings/settings-parser.c +++ b/src/lib-settings/settings-parser.c @@ -299,17 +299,11 @@ setting_define_find(const struct setting_parser_info *info, const char *key) return NULL; } -int settings_get_bool(const char *value, bool *result_r, - const char **error_r) -{ - return str_parse_get_bool(value, result_r, error_r); -} - static int get_bool(struct setting_parser_context *ctx, const char *value, bool *result_r) { int ret; - if ((ret = settings_get_bool(value, result_r, &ctx->error)) < 0) + if ((ret = str_parse_get_bool(value, result_r, &ctx->error)) < 0) ctx->error = p_strdup(ctx->parser_pool, ctx->error); return ret; } diff --git a/src/lib-settings/settings-parser.h b/src/lib-settings/settings-parser.h index 5a33466ce2..c2279265fd 100644 --- a/src/lib-settings/settings-parser.h +++ b/src/lib-settings/settings-parser.h @@ -276,9 +276,6 @@ int settings_get_time(const char *str, unsigned int *secs_r, /* Parse time interval string, return as milliseconds. */ int settings_get_time_msecs(const char *str, unsigned int *msecs_r, const char **error_r); -/* Parse boolean string, return as boolean */ -int settings_get_bool(const char *value, bool *result_r, - const char **error_r); void set_config_binary(bool value); bool is_config_binary(void); diff --git a/src/lib-sql/driver-sqlite.c b/src/lib-sql/driver-sqlite.c index 77bc59c439..8edb7c60b3 100644 --- a/src/lib-sql/driver-sqlite.c +++ b/src/lib-sql/driver-sqlite.c @@ -7,7 +7,7 @@ #include "hex-binary.h" #include "sql-api-private.h" #include "strfuncs.h" -#include "settings-parser.h" +#include "str-parse.h" #ifdef BUILD_SQLITE #include @@ -112,7 +112,7 @@ static int driver_sqlite_parse_connect_string(struct sqlite_db *db, return -1; } } else if (str_begins(*params, "readonly=", &arg)) { - if (settings_get_bool(arg, &val, error_r) < 0) { + if (str_parse_get_bool(arg, &val, error_r) < 0) { *error_r = t_strdup_printf("readonly: %s", *error_r); return -1; }