]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Replace settings_get_bool() with str_parse_get_bool() in project
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Wed, 26 Oct 2022 15:06:02 +0000 (17:06 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 21 Nov 2022 17:50:26 +0000 (17:50 +0000)
src/config/old-set-parser.c
src/lib-settings/settings-parser.c
src/lib-settings/settings-parser.h
src/lib-sql/driver-sqlite.c

index 859cd816283fdb44cd953ace3ef5bc820137ef70..115bb2ca282d1d262cc5db30f001265c1d2f37bc 100644 (file)
@@ -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");
index 7f19bed5918b65db59a7fddb1ff1f14285936825..8013c6e0cfbbbd4054b954f3e6fa6117860310ee 100644 (file)
@@ -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;
 }
index 5a33466ce2aa2ed240aa725aedc41057f06aff7c..c2279265fd3538823c44ea7030940b460095b6e1 100644 (file)
@@ -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);
index 77bc59c439d43b56ea25d9839247486b276139ce..8edb7c60b3bd66b87a2c0fce0e373feb4681f9a3 100644 (file)
@@ -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 <sqlite3.h>
@@ -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;
                        }