config/File: allow overriding top-level settings in includes

Remove the error message and instead erase the old setting if the
"repeatable" flag is not set.

https://github.com/MusicPlayerDaemon/MPD/issues/684
This commit is contained in:
Max Kellermann 2020-01-17 14:58:40 +01:00
parent ce7ec2b3f5
commit 4f11fa0d41
2 changed files with 5 additions and 5 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.21.19 (not yet released)
* configuration
- allow overriding top-level settings in includes
* output
- pulse: obey Pulse's maximum sample rate (fixes DSD128 playback)
* fix build failure with clang 10

View File

@ -153,11 +153,9 @@ ReadConfigParam(ConfigData &config_data, BufferedReader &reader,
name, reader.GetLineNumber());
if (!option.repeatable)
if (const auto *param = config_data.GetParam(o))
throw FormatRuntimeError("config parameter \"%s\" is first defined "
"on line %d and redefined on line %u\n",
name, param->line,
reader.GetLineNumber());
/* if the option is not repeatable, override the old
value by removing it first */
config_data.GetParamList(o).clear();
/* now parse the block or the value */