]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Initialize struct setting_define fields with explicit names
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 14:35:14 +0000 (17:35 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 18 Mar 2021 08:35:02 +0000 (08:35 +0000)
This allows changing the struct contents without breaking compiling.

12 files changed:
src/auth/auth-settings.c
src/dict/dict-settings.c
src/doveadm/doveadm-settings.c
src/imap/imap-settings.c
src/lib-lda/lda-settings.c
src/lib-settings/test-settings-parser.c
src/lib-smtp/smtp-submit-settings.c
src/lib-storage/mail-storage-settings.c
src/master/master-settings.c
src/plugins/mail-crypt/fs-crypt-settings.c
src/pop3/pop3-settings.c
src/stats/stats-settings.c

index df07c230358ffdba00eadd71b04e836ad57fcbd7..d9db5db1f83c50a3924f3b19f078d889425981be 100644 (file)
@@ -221,7 +221,9 @@ const struct setting_parser_info auth_userdb_setting_parser_info = {
 #define DEF_NOPREFIX(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct auth_settings)
 #define DEFLIST(field, name, defines) \
-       { SET_DEFLIST, name, offsetof(struct auth_settings, field), defines }
+       { .type = SET_DEFLIST, .key = name, \
+         .offset = offsetof(struct auth_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define auth_setting_defines[] = {
        DEF(STR, mechanisms),
index fdb81c9339e5afcd34d2709598cc49a880063744..01e9f15c3fec3ee8550965f49cb1ee9b7953819c 100644 (file)
@@ -89,7 +89,8 @@ static const struct setting_define dict_setting_defines[] = {
        DEF(BOOL, verbose_proctitle),
 
        DEF(STR, dict_db_config),
-       { SET_STRLIST, "dict", offsetof(struct dict_server_settings, dicts), NULL },
+       { .type = SET_STRLIST, .key = "dict",
+         .offset = offsetof(struct dict_server_settings, dicts) },
 
        SETTING_DEFINE_LIST_END
 };
index 61e2d96dffbd232a86f272d4abb5ba91ff8e01d1..e39f0060059f265ac5a0d5bae86b969164e8fd76 100644 (file)
@@ -66,7 +66,7 @@ static const struct setting_define doveadm_setting_defines[] = {
        DEF(STR, doveadm_socket_path),
        DEF(UINT, doveadm_worker_count),
        DEF(IN_PORT, doveadm_port),
-       { SET_ALIAS, "doveadm_proxy_port", 0, NULL },
+       { .type = SET_ALIAS, .key = "doveadm_proxy_port" },
        DEF(ENUM, doveadm_ssl),
        DEF(STR, doveadm_username),
        DEF(STR, doveadm_password),
@@ -80,7 +80,8 @@ static const struct setting_define doveadm_setting_defines[] = {
        DEF(STR, doveadm_http_rawlog_dir),
        DEF(STR, dsync_hashed_headers),
 
-       { SET_STRLIST, "plugin", offsetof(struct doveadm_settings, plugin_envs), NULL },
+       { .type = SET_STRLIST, .key = "plugin",
+         .offset = offsetof(struct doveadm_settings, plugin_envs) },
 
        SETTING_DEFINE_LIST_END
 };
index bb6361e85c7231293a2924b4b203c09b5de63307..71dcb745911909e8da20d99ebab0d7f10d9f788d 100644 (file)
@@ -60,7 +60,9 @@ struct service_settings imap_service_settings = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct imap_settings)
 #define DEFLIST(field, name, defines) \
-       { SET_DEFLIST, name, offsetof(struct imap_settings, field), defines }
+       { .type = SET_DEFLIST, .key = name, \
+         .offset = offsetof(struct imap_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define imap_setting_defines[] = {
        DEF(BOOL, verbose_proctitle),
index 1a09d0ecb84a5337b5eb769ffeb7b9380162641d..1bb02f8ff38e9397d1db472035d6df0a130a6793 100644 (file)
@@ -16,7 +16,9 @@ static bool lda_settings_check(void *_set, pool_t pool, const char **error_r);
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct lda_settings)
 #define DEFLIST(field, name, defines) \
-       { SET_DEFLIST, name, offsetof(struct lda_settings, field), defines }
+       { .type = SET_DEFLIST, .key = name, \
+         .offset = offsetof(struct lda_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define lda_setting_defines[] = {
        DEF(STR, hostname),
index c5a47dd6169aab81559b98572bb676f6e0cf2047..f0dd9cac4374bd8001024ae90b064b118283d6ad 100644 (file)
@@ -252,16 +252,16 @@ static void test_settings_parser_get(void)
                SETTING_DEFINE_STRUCT_BOOL("bool_true", bool_true, struct test_settings),
                SETTING_DEFINE_STRUCT_BOOL("bool_false", bool_false, struct test_settings),
                SETTING_DEFINE_STRUCT_UINT("uint", uint, struct test_settings),
-               { .type = SET_UINT_OCT, "uint_oct",
+               { .type = SET_UINT_OCT, .key = "uint_oct",
                  offsetof(struct test_settings, uint_oct), NULL },
                SETTING_DEFINE_STRUCT_TIME("secs", secs, struct test_settings),
                SETTING_DEFINE_STRUCT_TIME_MSECS("msecs", msecs, struct test_settings),
                SETTING_DEFINE_STRUCT_SIZE("size", size, struct test_settings),
                SETTING_DEFINE_STRUCT_IN_PORT("port", port, struct test_settings),
                SETTING_DEFINE_STRUCT_STR("str", str, struct test_settings),
-               { .type = SET_STR_VARS, "expand_str",
+               { .type = SET_STR_VARS, .key = "expand_str",
                  offsetof(struct test_settings, expand_str), NULL },
-               { .type = SET_STRLIST, "strlist",
+               { .type = SET_STRLIST, .key = "strlist",
                  offsetof(struct test_settings, strlist), NULL },
                SETTING_DEFINE_LIST_END
        };
index 4d36c56940d0ef504d70f649e15b8b32489373b5..cfe4afd4d02540cfc760a156a7c35c508cd1b787 100644 (file)
@@ -14,7 +14,9 @@ static bool smtp_submit_settings_check(void *_set, pool_t pool, const char **err
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct smtp_submit_settings)
 #define DEFLIST(field, name, defines) \
-       { SET_DEFLIST, name, offsetof(struct smtp_submit_settings, field), defines }
+       { .type = SET_DEFLIST, .key = name, \
+         .offset = offsetof(struct smtp_submit_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define smtp_submit_setting_defines[] = {
        DEF(STR, hostname),
index c898438cbd596bad3ce2f5018821a3e548f00132..080e328c9ba6cbc25d40e3a839db17f7c0b36df2 100644 (file)
@@ -30,7 +30,7 @@ static bool mail_user_settings_expand_check(void *_set, pool_t pool ATTR_UNUSED,
 
 static const struct setting_define mail_storage_setting_defines[] = {
        DEF(STR_VARS, mail_location),
-       { SET_ALIAS, "mail", 0, NULL },
+       { .type = SET_ALIAS, .key = "mail" },
        DEF(STR_VARS, mail_attachment_fs),
        DEF(STR_VARS, mail_attachment_dir),
        DEF(STR, mail_attachment_hash),
@@ -182,7 +182,8 @@ const struct setting_parser_info mail_storage_setting_parser_info = {
 
 static const struct setting_define mailbox_setting_defines[] = {
        DEF(STR, name),
-       { SET_ENUM, "auto", offsetof(struct mailbox_settings, autocreate), NULL } ,
+       { .type = SET_ENUM, .key = "auto",
+         .offset = offsetof(struct mailbox_settings, autocreate) } ,
        DEF(STR, special_use),
        DEF(STR, driver),
        DEF(STR, comment),
@@ -222,8 +223,9 @@ const struct setting_parser_info mailbox_setting_parser_info = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct mail_namespace_settings)
 #define DEFLIST_UNIQUE(field, name, defines) \
-       { SET_DEFLIST_UNIQUE, name, \
-         offsetof(struct mail_namespace_settings, field), defines }
+       { .type = SET_DEFLIST_UNIQUE, .key = name, \
+         .offset = offsetof(struct mail_namespace_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define mail_namespace_setting_defines[] = {
        DEF(STR, name),
@@ -231,8 +233,8 @@ static const struct setting_define mail_namespace_setting_defines[] = {
        DEF(STR, separator),
        DEF(STR_VARS, prefix),
        DEF(STR_VARS, location),
-       { SET_ALIAS, "mail", 0, NULL },
-       { SET_ALIAS, "mail_location", 0, NULL },
+       { .type = SET_ALIAS, .key = "mail" },
+       { .type = SET_ALIAS, .key = "mail_location" },
        DEF(STR_VARS, alias_for),
 
        DEF(BOOL, inbox),
@@ -285,8 +287,9 @@ const struct setting_parser_info mail_namespace_setting_parser_info = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct mail_user_settings)
 #define DEFLIST_UNIQUE(field, name, defines) \
-       { SET_DEFLIST_UNIQUE, name, \
-         offsetof(struct mail_user_settings, field), defines }
+       { .type = SET_DEFLIST_UNIQUE, .key = name, \
+         .offset = offsetof(struct mail_user_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define mail_user_setting_defines[] = {
        DEF(STR, base_dir),
@@ -315,7 +318,8 @@ static const struct setting_define mail_user_setting_defines[] = {
        DEF(STR_VARS, postmaster_address),
 
        DEFLIST_UNIQUE(namespaces, "namespace", &mail_namespace_setting_parser_info),
-       { SET_STRLIST, "plugin", offsetof(struct mail_user_settings, plugin_envs), NULL },
+       { .type = SET_STRLIST, .key = "plugin",
+         .offset = offsetof(struct mail_user_settings, plugin_envs) },
 
        SETTING_DEFINE_LIST_END
 };
index 285995d766579925a2ede2e0cfeac32dc2358a86..d4105d55a6758d2213d8a5ac01c254f7042c4dce 100644 (file)
@@ -95,7 +95,9 @@ static const struct setting_parser_info inet_listener_setting_parser_info = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct service_settings)
 #define DEFLIST_UNIQUE(field, name, defines) \
-       { SET_DEFLIST_UNIQUE, name, offsetof(struct service_settings, field), defines }
+       { .type = SET_DEFLIST_UNIQUE, .key = name, \
+         .offset = offsetof(struct service_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define service_setting_defines[] = {
        DEF(STR, name),
@@ -168,7 +170,9 @@ const struct setting_parser_info service_setting_parser_info = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct master_settings)
 #define DEFLIST_UNIQUE(field, name, defines) \
-       { SET_DEFLIST_UNIQUE, name, offsetof(struct master_settings, field), defines }
+       { .type = SET_DEFLIST_UNIQUE, .key = name, \
+         .offset = offsetof(struct master_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define master_setting_defines[] = {
        DEF(STR, base_dir),
index e09e8da58e02bf38e4c08774d0ce7d627ba4f6d8..ba70f8a977f643dab72b8e620136a7163278703a 100644 (file)
@@ -8,7 +8,8 @@
 #include "fs-crypt-settings.h"
 
 static const struct setting_define fs_crypt_setting_defines[] = {
-       { SET_STRLIST, "plugin", offsetof(struct fs_crypt_settings, plugin_envs), NULL },
+       { .type = SET_STRLIST, .key = "plugin",
+         .offset = offsetof(struct fs_crypt_settings, plugin_envs) },
 
        SETTING_DEFINE_LIST_END
 };
index 7724072ae53b99d5fb5c5a56adf8bfc13245f7f1..efc6bfd6a878b81c33698d91d300fba2618db8cd 100644 (file)
@@ -56,7 +56,9 @@ struct service_settings pop3_service_settings = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct pop3_settings)
 #define DEFLIST(field, name, defines) \
-       { SET_DEFLIST, name, offsetof(struct pop3_settings, field), defines }
+       { .type = SET_DEFLIST, .key = name, \
+         .offset = offsetof(struct pop3_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define pop3_setting_defines[] = {
        DEF(BOOL, verbose_proctitle),
index d752734461f70b7dbd1ddfd1e73e5f611c39d2da..50020df678c7f2772f00b27dd0c42b9b944e5c2a 100644 (file)
@@ -142,8 +142,9 @@ const struct setting_parser_info stats_metric_setting_parser_info = {
        SETTING_DEFINE_STRUCT_##type(#name, name, struct stats_settings)
 #undef DEFLIST_UNIQUE
 #define DEFLIST_UNIQUE(field, name, defines) \
-       { SET_DEFLIST_UNIQUE, name, \
-         offsetof(struct stats_settings, field), defines }
+       { .type = SET_DEFLIST_UNIQUE, .key = name, \
+         .offset = offsetof(struct stats_settings, field), \
+         .list_info = defines }
 
 static const struct setting_define stats_setting_defines[] = {
        DEF(STR, stats_http_rawlog_dir),