struct config_parser_context {
pool_t pool;
const char *path;
+ enum config_parse_flags flags;
ARRAY_TYPE(config_path) seen_paths;
HASH_TABLE_TYPE(config_key) all_keys;
struct config_filter_context *filter;
bool dump_defaults:1;
bool expand_values:1;
- bool hide_errors:1;
- bool delay_errors:1;
- bool hide_obsolete_warnings:1;
- bool ignore_unknown:1;
/* All config_filter_parsers have reverse_default_sibling set. */
bool reverse_parsers_set:1;
};
{
struct config_parser_key *config_key;
- if (!ctx->delay_errors)
+ if ((ctx->flags & CONFIG_PARSE_FLAG_DELAY_ERRORS) == 0)
return -1;
/* Couldn't get value for the setting, but we're delaying error
}
ctx->cur_section->filter_parser = orig_filter_parser;
if (ret == 0) {
- if (ctx->ignore_unknown)
+ if ((ctx->flags & CONFIG_PARSE_FLAG_IGNORE_UNKNOWN) != 0)
return 0;
config_set_unknown_key_error(ctx, key);
return -1;
if (!ok) {
/* be sure to assert-crash early if error is missing */
i_assert(error != NULL);
- if (!ctx->delay_errors) {
+ if ((ctx->flags & CONFIG_PARSE_FLAG_DELAY_ERRORS) == 0) {
/* the errors are still slightly delayed so
we get the full list of them. */
error = p_strdup(new_config->pool, error);
break;
}
if (hash_table_lookup(ctx->all_keys, key) == NULL) {
- if (ctx->ignore_unknown)
+ if ((ctx->flags & CONFIG_PARSE_FLAG_IGNORE_UNKNOWN) != 0)
break;
if (attempts != NULL)
str_append(attempts, " not found either.)");
ctx.pool = pool_alloconly_create(MEMPOOL_GROWING"config file parser", 1024*256);
ctx.path = path;
ctx.dump_defaults = dump_defaults;
- ctx.hide_obsolete_warnings =
- (flags & CONFIG_PARSE_FLAG_HIDE_OBSOLETE_WARNINGS) != 0;
- ctx.delay_errors = (flags & CONFIG_PARSE_FLAG_DELAY_ERRORS) != 0;
- ctx.ignore_unknown = (flags & CONFIG_PARSE_FLAG_IGNORE_UNKNOWN) != 0;
+ ctx.flags = flags;
hash_table_create(&ctx.all_keys, ctx.pool, 500, str_hash, strcmp);
p_array_init(&ctx.seen_paths, ctx.pool, 8);
if (fd != -1) {