From ea5096ac905e9871adf72f5abcb26b14a7a88812 Mon Sep 17 00:00:00 2001 From: Max Kellermann <max@musicpd.org> Date: Tue, 17 Jul 2018 21:55:15 +0200 Subject: [PATCH] test/read_conf: use struct ConfigData --- test/read_conf.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/read_conf.cxx b/test/read_conf.cxx index e2b290b72..ebd91398e 100644 --- a/test/read_conf.cxx +++ b/test/read_conf.cxx @@ -18,7 +18,9 @@ */ #include "config.h" -#include "config/Global.hxx" +#include "config/Data.hxx" +#include "config/Param.hxx" +#include "config/File.hxx" #include "fs/Path.hxx" #include "fs/Path.hxx" #include "util/PrintException.hxx" @@ -42,16 +44,14 @@ try { if (option == ConfigOption::MAX) throw FormatRuntimeError("Unknown setting: %s", name); - config_global_init(); + ConfigData config; + ReadConfigFile(config, config_path); - ReadConfigFile(config_path); - - const char *value = config_get_string(option); - if (value == nullptr) + const auto *param = config.GetParam(option); + if (param == nullptr) throw FormatRuntimeError("No such setting: %s", name); - printf("%s\n", value); - config_global_finish(); + printf("%s\n", param->value.c_str()); return EXIT_SUCCESS; } catch (...) { PrintException(std::current_exception());