diff options
author | Max Kellermann <max@duempel.org> | 2008-11-27 19:19:34 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-11-27 19:19:34 +0100 |
commit | bd0653f440adf736427d9cc9e3565489cc9a1cde (patch) | |
tree | 7714fcf736fb3711050d80baf4a0d696bef26293 /src/conf.c | |
parent | 910c0009542a27bd1e4efe5491a01a97a9d0233e (diff) | |
download | mpd-bd0653f440adf736427d9cc9e3565489cc9a1cde.tar.gz mpd-bd0653f440adf736427d9cc9e3565489cc9a1cde.tar.xz mpd-bd0653f440adf736427d9cc9e3565489cc9a1cde.zip |
conf: added config_get_bool()
In contrast to, getBoolConfigParam(), config_get_bool() properly
returns a "bool" value. In case of "unset", it returns the default
value provided by the caller.
Diffstat (limited to '')
-rw-r--r-- | src/conf.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/conf.c b/src/conf.c index 10d0f9d31..885da1f29 100644 --- a/src/conf.c +++ b/src/conf.c @@ -418,6 +418,16 @@ int getBoolConfigParam(const char *name, int force) return ret; } +bool config_get_bool(const char *name, bool default_value) +{ + int value = getBoolConfigParam(name, true); + + if (value == CONF_BOOL_UNSET) + return default_value; + + return value; +} + int getBoolBlockParam(ConfigParam *param, const char *name, int force) { int ret; |