From 4f11fa0d419af1c911e2dd5caa9d8e6ebe7e4027 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 17 Jan 2020 14:58:40 +0100 Subject: [PATCH] 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 --- NEWS | 2 ++ src/config/File.cxx | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index e7c38ca97..7cd878032 100644 --- a/NEWS +++ b/NEWS @@ -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 diff --git a/src/config/File.cxx b/src/config/File.cxx index b0361bc6b..269ea8419 100644 --- a/src/config/File.cxx +++ b/src/config/File.cxx @@ -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 */