diff options
author | Max Kellermann <max@duempel.org> | 2015-06-26 08:05:20 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-06-26 08:06:40 +0200 |
commit | 58996b841ac1a19794d704b5622480adc165c434 (patch) | |
tree | 8426bcf8bfbb686a884e2fc513b1c95b518b02ff /src | |
parent | df03a7b3f82a5ab97d54c64ef249fe98782e199c (diff) | |
download | mpd-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/config/ConfigGlobal.hxx | 2 | ||||
-rw-r--r-- | src/config/ConfigPath.cxx | 2 | ||||
-rw-r--r-- | src/fs/Config.cxx | 4 | ||||
-rw-r--r-- | src/input/plugins/CurlInputPlugin.cxx | 4 | ||||
-rw-r--r-- | src/storage/Configured.cxx | 4 | ||||
-rw-r--r-- | src/tag/TagConfig.cxx | 3 |
6 files changed, 8 insertions, 11 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; |