diff options
author | Max Kellermann <max@musicpd.org> | 2019-04-24 15:18:01 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-04-25 12:05:18 +0200 |
commit | 77c9081f781c4afd975f58b549ed47bd35375ce2 (patch) | |
tree | 8ba8657373601e329e0d1de7510833bcea87e6a1 /src/Main.cxx | |
parent | c88d5616f70819ce6e09255aeacc9153f58a56ec (diff) |
sticker/Database: wrap in class StickerDatabase
Diffstat (limited to 'src/Main.cxx')
-rw-r--r-- | src/Main.cxx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index 9a2919d79..52367b029 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -237,23 +237,23 @@ InitDatabaseAndStorage(const ConfigData &config) #endif +#ifdef ENABLE_SQLITE + /** * Configure and initialize the sticker subsystem. */ -static void -glue_sticker_init(const ConfigData &config) +static std::unique_ptr<StickerDatabase> +LoadStickerDatabase(const ConfigData &config) { -#ifdef ENABLE_SQLITE auto sticker_file = config.GetPath(ConfigOption::STICKER_FILE); if (sticker_file.IsNull()) - return; + return nullptr; - sticker_global_init(std::move(sticker_file)); -#else - (void)config; -#endif + return std::make_unique<StickerDatabase>(std::move(sticker_file)); } +#endif + static void glue_state_file_init(const ConfigData &raw_config) { @@ -513,7 +513,9 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config) const bool create_db = InitDatabaseAndStorage(raw_config); #endif - glue_sticker_init(raw_config); +#ifdef ENABLE_SQLITE + instance->sticker_database = LoadStickerDatabase(raw_config); +#endif command_init(); @@ -625,10 +627,6 @@ mpd_main_after_fork(const ConfigData &raw_config, const Config &config) } #endif -#ifdef ENABLE_SQLITE - sticker_global_finish(); -#endif - return EXIT_SUCCESS; } |