diff options
Diffstat (limited to 'src/config.c')
| -rw-r--r-- | src/config.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/src/config.c b/src/config.c index 1f2698b..9a2bc42 100644 --- a/src/config.c +++ b/src/config.c @@ -254,11 +254,9 @@ static config_status_t config_read_block(const config_block_t *info, block_t *bl const char *section, const char *key, const char *value) { config_status_t status = config_read_entry(block_entries, block, type, section, key, value); - - if (status == CONFIG_INVALID) - return status; - - return config_read_entry(info->entries, result, type, section, key, value); + return status != CONFIG_UNKNOWN + ? status + : config_read_entry(info->entries, result, type, section, key, value); } void config_init(config_t *config) @@ -373,33 +371,33 @@ void config_read(config_t *config, FILE *file) &type, section, key, value); else if (entries != NULL) status = config_read_entry(entries, result, &type, section, key, value); + else + goto skip_pair; - if (block != NULL || entries != NULL) { - switch (status) { - case CONFIG_SUCCESS: - break; - - case CONFIG_INVALID: - errors++; - log_value_error("Invalid entry", - "s:section", section, - "s:key", key, - "s:value", value, - "s:type", type, - "i:line", ini.line); - break; - - case CONFIG_UNKNOWN: - log_value_warn("Unknown entry", - "s:section", section, - "s:key", key, - "s:value", value, - "i:line", ini.line); - break; - - default: - unreachable(); - } + switch (status) { + case CONFIG_SUCCESS: + break; + + case CONFIG_INVALID: + errors++; + log_value_error("Invalid entry", + "s:section", section, + "s:key", key, + "s:value", value, + "s:type", type, + "i:line", ini.line); + break; + + case CONFIG_UNKNOWN: + log_value_warn("Unknown entry", + "s:section", section, + "s:key", key, + "s:value", value, + "i:line", ini.line); + break; + + default: + unreachable(); } skip_pair: |
