From: Timo Sirainen Date: Wed, 15 Apr 2020 14:35:14 +0000 (+0300) Subject: global: Initialize struct setting_define fields with explicit names X-Git-Tag: 2.3.15~191 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0ce3e66e7bbcf557cf432e5f2b83f495349ce3dd;p=thirdparty%2Fdovecot%2Fcore.git global: Initialize struct setting_define fields with explicit names This allows changing the struct contents without breaking compiling. --- diff --git a/src/auth/auth-settings.c b/src/auth/auth-settings.c index df07c23035..d9db5db1f8 100644 --- a/src/auth/auth-settings.c +++ b/src/auth/auth-settings.c @@ -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), diff --git a/src/dict/dict-settings.c b/src/dict/dict-settings.c index fdb81c9339..01e9f15c3f 100644 --- a/src/dict/dict-settings.c +++ b/src/dict/dict-settings.c @@ -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 }; diff --git a/src/doveadm/doveadm-settings.c b/src/doveadm/doveadm-settings.c index 61e2d96dff..e39f006005 100644 --- a/src/doveadm/doveadm-settings.c +++ b/src/doveadm/doveadm-settings.c @@ -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 }; diff --git a/src/imap/imap-settings.c b/src/imap/imap-settings.c index bb6361e85c..71dcb74591 100644 --- a/src/imap/imap-settings.c +++ b/src/imap/imap-settings.c @@ -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), diff --git a/src/lib-lda/lda-settings.c b/src/lib-lda/lda-settings.c index 1a09d0ecb8..1bb02f8ff3 100644 --- a/src/lib-lda/lda-settings.c +++ b/src/lib-lda/lda-settings.c @@ -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), diff --git a/src/lib-settings/test-settings-parser.c b/src/lib-settings/test-settings-parser.c index c5a47dd616..f0dd9cac43 100644 --- a/src/lib-settings/test-settings-parser.c +++ b/src/lib-settings/test-settings-parser.c @@ -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 }; diff --git a/src/lib-smtp/smtp-submit-settings.c b/src/lib-smtp/smtp-submit-settings.c index 4d36c56940..cfe4afd4d0 100644 --- a/src/lib-smtp/smtp-submit-settings.c +++ b/src/lib-smtp/smtp-submit-settings.c @@ -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), diff --git a/src/lib-storage/mail-storage-settings.c b/src/lib-storage/mail-storage-settings.c index c898438cbd..080e328c9b 100644 --- a/src/lib-storage/mail-storage-settings.c +++ b/src/lib-storage/mail-storage-settings.c @@ -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 }; diff --git a/src/master/master-settings.c b/src/master/master-settings.c index 285995d766..d4105d55a6 100644 --- a/src/master/master-settings.c +++ b/src/master/master-settings.c @@ -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), diff --git a/src/plugins/mail-crypt/fs-crypt-settings.c b/src/plugins/mail-crypt/fs-crypt-settings.c index e09e8da58e..ba70f8a977 100644 --- a/src/plugins/mail-crypt/fs-crypt-settings.c +++ b/src/plugins/mail-crypt/fs-crypt-settings.c @@ -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 }; diff --git a/src/pop3/pop3-settings.c b/src/pop3/pop3-settings.c index 7724072ae5..efc6bfd6a8 100644 --- a/src/pop3/pop3-settings.c +++ b/src/pop3/pop3-settings.c @@ -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), diff --git a/src/stats/stats-settings.c b/src/stats/stats-settings.c index d752734461..50020df678 100644 --- a/src/stats/stats-settings.c +++ b/src/stats/stats-settings.c @@ -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),