aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-06-26 08:05:20 +0200
committerMax Kellermann <max@duempel.org>2015-06-26 08:06:40 +0200
commit58996b841ac1a19794d704b5622480adc165c434 (patch)
tree8426bcf8bfbb686a884e2fc513b1c95b518b02ff
parentdf03a7b3f82a5ab97d54c64ef249fe98782e199c (diff)
downloadmpd-58996b841ac1a19794d704b5622480adc165c434.tar.gz
mpd-58996b841ac1a19794d704b5622480adc165c434.tar.xz
mpd-58996b841ac1a19794d704b5622480adc165c434.zip
config/Global: allow calling config_get_string() with one argument
default_value defaults to nullptr.
-rw-r--r--src/config/ConfigGlobal.hxx2
-rw-r--r--src/config/ConfigPath.cxx2
-rw-r--r--src/fs/Config.cxx4
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx4
-rw-r--r--src/storage/Configured.cxx4
-rw-r--r--src/tag/TagConfig.cxx3
-rw-r--r--test/read_conf.cxx2
7 files changed, 9 insertions, 12 deletions
diff --git a/src/config/ConfigGlobal.hxx b/src/config/ConfigGlobal.hxx
index 9e8687e82..b24b9aada 100644
--- a/src/config/ConfigGlobal.hxx
+++ b/src/config/ConfigGlobal.hxx
@@ -73,7 +73,7 @@ config_find_block(ConfigBlockOption option, const char *key, const char *value);
gcc_pure
const char *
-config_get_string(enum ConfigOption option, const char *default_value);
+config_get_string(enum ConfigOption option, const char *default_value=nullptr);
/**
* Returns an optional configuration variable which contains an
diff --git a/src/config/ConfigPath.cxx b/src/config/ConfigPath.cxx
index fe42fdf60..c1e57b3ba 100644
--- a/src/config/ConfigPath.cxx
+++ b/src/config/ConfigPath.cxx
@@ -70,7 +70,7 @@ GetHome(Error &error)
static AllocatedPath
GetConfiguredHome(Error &error)
{
- const char *user = config_get_string(ConfigOption::USER, nullptr);
+ const char *user = config_get_string(ConfigOption::USER);
return user != nullptr
? GetHome(user, error)
: GetHome(error);
diff --git a/src/fs/Config.cxx b/src/fs/Config.cxx
index d40fa45cf..0b39a362f 100644
--- a/src/fs/Config.cxx
+++ b/src/fs/Config.cxx
@@ -26,9 +26,7 @@ bool
ConfigureFS(Error &error)
{
#ifdef HAVE_FS_CHARSET
- const char *charset = nullptr;
-
- charset = config_get_string(ConfigOption::FS_CHARSET, nullptr);
+ const char *charset = config_get_string(ConfigOption::FS_CHARSET);
return charset == nullptr || SetFSCharset(charset, error);
#else
(void)error;
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index ade8324ec..814fe7a32 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -566,9 +566,9 @@ input_curl_init(const ConfigBlock &block, Error &error)
if (proxy == nullptr) {
/* deprecated proxy configuration */
- proxy = config_get_string(ConfigOption::HTTP_PROXY_HOST, nullptr);
+ proxy = config_get_string(ConfigOption::HTTP_PROXY_HOST);
proxy_port = config_get_positive(ConfigOption::HTTP_PROXY_PORT, 0);
- proxy_user = config_get_string(ConfigOption::HTTP_PROXY_USER, nullptr);
+ proxy_user = config_get_string(ConfigOption::HTTP_PROXY_USER);
proxy_password = config_get_string(ConfigOption::HTTP_PROXY_PASSWORD,
"");
}
diff --git a/src/storage/Configured.cxx b/src/storage/Configured.cxx
index adb5c7dc5..d3a55eab8 100644
--- a/src/storage/Configured.cxx
+++ b/src/storage/Configured.cxx
@@ -68,7 +68,7 @@ CreateConfiguredStorage(EventLoop &event_loop, Error &error)
{
assert(!error.IsDefined());
- auto uri = config_get_string(ConfigOption::MUSIC_DIR, nullptr);
+ auto uri = config_get_string(ConfigOption::MUSIC_DIR);
if (uri != nullptr && uri_has_scheme(uri))
return CreateConfiguredStorageUri(event_loop, uri, error);
@@ -78,5 +78,5 @@ CreateConfiguredStorage(EventLoop &event_loop, Error &error)
bool
IsStorageConfigured()
{
- return config_get_string(ConfigOption::MUSIC_DIR, nullptr) != nullptr;
+ return config_get_string(ConfigOption::MUSIC_DIR) != nullptr;
}
diff --git a/src/tag/TagConfig.cxx b/src/tag/TagConfig.cxx
index df40c2bc0..e4d40696d 100644
--- a/src/tag/TagConfig.cxx
+++ b/src/tag/TagConfig.cxx
@@ -35,8 +35,7 @@
void
TagLoadConfig()
{
- const char *value = config_get_string(ConfigOption::METADATA_TO_USE,
- nullptr);
+ const char *value = config_get_string(ConfigOption::METADATA_TO_USE);
if (value == nullptr)
return;
diff --git a/test/read_conf.cxx b/test/read_conf.cxx
index cb3cb207e..fdf93a40d 100644
--- a/test/read_conf.cxx
+++ b/test/read_conf.cxx
@@ -47,7 +47,7 @@ int main(int argc, char **argv)
ConfigOption option = ParseConfigOptionName(name);
const char *value = option != ConfigOption::MAX
- ? config_get_string(option, nullptr)
+ ? config_get_string(option)
: nullptr;
int ret;
if (value != NULL) {