config/Global: allow calling config_get_string() with one argument
default_value defaults to nullptr.
This commit is contained in:
parent
df03a7b3f8
commit
58996b841a
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
"");
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user