From 426b9672cf4899b4b4bf10e63d1f635366d37f01 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 17 Jul 2018 23:06:17 +0200 Subject: [PATCH] db/Configured: use struct ConfigData --- src/Main.cxx | 2 +- src/db/Configured.cxx | 9 +++++---- src/db/Configured.hxx | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index b40f870b0..e8758ef37 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -186,7 +186,7 @@ static bool glue_db_init_and_load(const ConfigData &config) { instance->database = - CreateConfiguredDatabase(instance->event_loop, + CreateConfiguredDatabase(config, instance->event_loop, instance->io_thread.GetEventLoop(), *instance); if (instance->database == nullptr) diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index 3e8a6553f..e5d8b99ba 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "Configured.hxx" #include "DatabaseGlue.hxx" -#include "config/Global.hxx" +#include "config/Data.hxx" #include "config/Param.hxx" #include "config/Block.hxx" #include "fs/AllocatedPath.hxx" @@ -28,11 +28,12 @@ #include "util/RuntimeError.hxx" Database * -CreateConfiguredDatabase(EventLoop &main_event_loop, EventLoop &io_event_loop, +CreateConfiguredDatabase(const ConfigData &config, + EventLoop &main_event_loop, EventLoop &io_event_loop, DatabaseListener &listener) { - const auto *param = config_get_block(ConfigBlockOption::DATABASE); - const auto *path = config_get_param(ConfigOption::DB_FILE); + const auto *param = config.GetBlock(ConfigBlockOption::DATABASE); + const auto *path = config.GetParam(ConfigOption::DB_FILE); if (param != nullptr && path != nullptr) throw FormatRuntimeError("Found both 'database' (line %d) and 'db_file' (line %d) setting", diff --git a/src/db/Configured.hxx b/src/db/Configured.hxx index 287a40438..0edc9dd1b 100644 --- a/src/db/Configured.hxx +++ b/src/db/Configured.hxx @@ -22,6 +22,7 @@ #include "check.h" +struct ConfigData; class EventLoop; class DatabaseListener; class Database; @@ -34,7 +35,8 @@ class Database; * Throws #std::runtime_error on error. */ Database * -CreateConfiguredDatabase(EventLoop &main_event_loop, EventLoop &io_event_loop, +CreateConfiguredDatabase(const ConfigData &config, + EventLoop &main_event_loop, EventLoop &io_event_loop, DatabaseListener &listener); #endif