From: Timo Sirainen Date: Fri, 11 Apr 2025 10:38:28 +0000 (+0300) Subject: config: Change struct config_parsed parameters const for most functions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea86b8a2a79ca1060394761c645b474810c2763e;p=thirdparty%2Fdovecot%2Fcore.git config: Change struct config_parsed parameters const for most functions --- diff --git a/src/config/config-parser.c b/src/config/config-parser.c index bddfd73215..7b95c31f94 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -3191,7 +3191,7 @@ prevfile: return ret < 0 ? ret : 1; } -bool config_parsed_get_version(struct config_parsed *config, +bool config_parsed_get_version(const struct config_parsed *config, const char **version_r) { *version_r = config->dovecot_config_version; @@ -3199,31 +3199,31 @@ bool config_parsed_get_version(struct config_parsed *config, } const ARRAY_TYPE(const_string) * -config_parsed_get_errors(struct config_parsed *config) +config_parsed_get_errors(const struct config_parsed *config) { return &config->errors; } struct config_filter_parser * -config_parsed_get_global_filter_parser(struct config_parsed *config) +config_parsed_get_global_filter_parser(const struct config_parsed *config) { return config->filter_parsers[0]; } struct config_filter_parser * -config_parsed_get_global_default_filter_parser(struct config_parsed *config) +config_parsed_get_global_default_filter_parser(const struct config_parsed *config) { return config->filter_parsers[1]; } struct config_filter_parser *const * -config_parsed_get_filter_parsers(struct config_parsed *config) +config_parsed_get_filter_parsers(const struct config_parsed *config) { return config->filter_parsers; } HASH_TABLE_TYPE(config_key) -config_parsed_get_all_keys(struct config_parsed *config) +config_parsed_get_all_keys(const struct config_parsed *config) { return config->all_keys; } @@ -3261,7 +3261,7 @@ config_parsed_strlist_append(string_t *keyvals, } static const char * -config_parsed_get_setting_full(struct config_parsed *config, +config_parsed_get_setting_full(const struct config_parsed *config, const char *info_name, const char *key, unsigned int *change_counter_r) { @@ -3320,14 +3320,14 @@ config_parsed_get_setting_full(struct config_parsed *config, } const char * -config_parsed_get_setting(struct config_parsed *config, +config_parsed_get_setting(const struct config_parsed *config, const char *info_name, const char *key) { return config_parsed_get_setting_full(config, info_name, key, NULL); } unsigned int -config_parsed_get_setting_change_counter(struct config_parsed *config, +config_parsed_get_setting_change_counter(const struct config_parsed *config, const char *info_name, const char *key) { unsigned int change_counter; @@ -3338,7 +3338,7 @@ config_parsed_get_setting_change_counter(struct config_parsed *config, } const struct setting_define * -config_parsed_key_lookup(struct config_parsed *config, const char *key) +config_parsed_key_lookup(const struct config_parsed *config, const char *key) { struct config_parser_key *config_key = hash_table_lookup(config->all_keys, key); @@ -3378,7 +3378,7 @@ config_include_group_filters_have_settings( return FALSE; } -bool config_parsed_get_includes(struct config_parsed *config, +bool config_parsed_get_includes(const struct config_parsed *config, const struct config_filter_parser *filter, unsigned int parser_idx, ARRAY_TYPE(config_include_group) *groups) @@ -3402,7 +3402,7 @@ bool config_parsed_get_includes(struct config_parsed *config, } const ARRAY_TYPE(config_path) * -config_parsed_get_paths(struct config_parsed *config) +config_parsed_get_paths(const struct config_parsed *config) { return &config->seen_paths; } diff --git a/src/config/config-parser.h b/src/config/config-parser.h index be0714e918..ed32928def 100644 --- a/src/config/config-parser.h +++ b/src/config/config-parser.h @@ -98,49 +98,49 @@ int config_parse_file(const char *path, enum config_parse_flags flags, struct config_parsed **config_r, const char **error_r) ATTR_NULL(3); -bool config_parsed_get_version(struct config_parsed *config, +bool config_parsed_get_version(const struct config_parsed *config, const char **version_r); /* Return all errors found while parsing the config file. */ const ARRAY_TYPE(const_string) * -config_parsed_get_errors(struct config_parsed *config); +config_parsed_get_errors(const struct config_parsed *config); /* Returns the global filter */ struct config_filter_parser * -config_parsed_get_global_filter_parser(struct config_parsed *config); +config_parsed_get_global_filter_parser(const struct config_parsed *config); /* Returns the global default filter */ struct config_filter_parser * -config_parsed_get_global_default_filter_parser(struct config_parsed *config); +config_parsed_get_global_default_filter_parser(const struct config_parsed *config); /* Returns all filters */ struct config_filter_parser *const * -config_parsed_get_filter_parsers(struct config_parsed *config); +config_parsed_get_filter_parsers(const struct config_parsed *config); /* Fill settings parser with settings from the given module parser. */ void config_fill_set_parser(struct setting_parser_context *parser, const struct config_module_parser *p, bool expand_values); HASH_TABLE_TYPE(config_key) -config_parsed_get_all_keys(struct config_parsed *config); +config_parsed_get_all_keys(const struct config_parsed *config); /* Returns the value for a specified setting. The setting must be found and it must be a string, or the function panics. */ const char * -config_parsed_get_setting(struct config_parsed *config, +config_parsed_get_setting(const struct config_parsed *config, const char *info_name, const char *key); /* Return the change_counter for the specified setting. */ unsigned int -config_parsed_get_setting_change_counter(struct config_parsed *config, +config_parsed_get_setting_change_counter(const struct config_parsed *config, const char *info_name, const char *key); /* Lookup setting with the specified key. */ const struct setting_define * -config_parsed_key_lookup(struct config_parsed *config, const char *key); +config_parsed_key_lookup(const struct config_parsed *config, const char *key); /* Get the list of filter's include groups that have any settings in the given module parser index. Returns TRUE if any groups were returned. */ -bool config_parsed_get_includes(struct config_parsed *config, +bool config_parsed_get_includes(const struct config_parsed *config, const struct config_filter_parser *filter, unsigned int parser_idx, ARRAY_TYPE(config_include_group) *groups); /* Get all paths used for generating the config */ const ARRAY_TYPE(config_path) * -config_parsed_get_paths(struct config_parsed *config); +config_parsed_get_paths(const struct config_parsed *config); void config_parsed_free(struct config_parsed **config); void config_parse_load_modules(bool dump_config_import);