aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-17 20:23:56 +0100
committerMax Kellermann <max@duempel.org>2009-01-17 20:23:56 +0100
commit7acc62366cb59aba414821563cc89e01e96c1987 (patch)
tree67ad209293ec42de76ad2f12c09527f7d13698f1 /src/conf.c
parenta1a97cc048a443eb71944848592b9827991600fd (diff)
downloadmpd-7acc62366cb59aba414821563cc89e01e96c1987.tar.gz
mpd-7acc62366cb59aba414821563cc89e01e96c1987.tar.xz
mpd-7acc62366cb59aba414821563cc89e01e96c1987.zip
conf: replaced getBoolBlockParam() with config_get_block_bool()
No "force" parameter, pass a default value instead.
Diffstat (limited to 'src/conf.c')
-rw-r--r--src/conf.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/conf.c b/src/conf.c
index d1decadcd..f8ee5519a 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -449,20 +449,24 @@ bool config_get_bool(const char *name, bool default_value)
return !!value;
}
-int
-getBoolBlockParam(struct config_param *param, const char *name, int force)
+bool
+config_get_block_bool(struct config_param *param, const char *name,
+ bool default_value)
{
- int ret;
struct block_param *bp = getBlockParam(param, name);
+ int value;
- if (!bp)
- return CONF_BOOL_UNSET;
+ if (bp == NULL)
+ return default_value;
- ret = get_bool(bp->value);
- if (force && ret == CONF_BOOL_INVALID)
+ value = get_bool(bp->value);
+ if (value == CONF_BOOL_INVALID)
g_error("%s is not a boolean value (yes, true, 1) or "
"(no, false, 0) on line %i\n",
- bp->value, bp->line);
- return ret;
-}
+ name, bp->line);
+ if (value == CONF_BOOL_UNSET)
+ return default_value;
+
+ return !!value;
+}