From 9f5c938ff3cfe6f264340461c88defa2bb614cb0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 9 Sep 2011 22:15:28 +0200 Subject: conf: add config_dup_block_path() --- src/conf.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/conf.c') diff --git a/src/conf.c b/src/conf.c index 245a2a811..9e9c199fd 100644 --- a/src/conf.c +++ b/src/conf.c @@ -606,6 +606,26 @@ config_get_block_string(const struct config_param *param, const char *name, return bp->value; } +char * +config_dup_block_path(const struct config_param *param, const char *name, + GError **error_r) +{ + assert(error_r != NULL); + assert(*error_r == NULL); + + const struct block_param *bp = config_get_block_param(param, name); + if (bp == NULL) + return NULL; + + char *path = parsePath(bp->value, error_r); + if (G_UNLIKELY(path == NULL)) + g_prefix_error(error_r, + "Invalid path in \"%s\" at line %i: ", + name, bp->line); + + return path; +} + unsigned config_get_block_unsigned(const struct config_param *param, const char *name, unsigned default_value) -- cgit v1.2.3