From d3293b889d20433adede6a248582ce778e1c87b8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 00:24:45 +0100 Subject: database.h: move prototypes to DatabaseGlue.hxx --- src/DatabaseGlue.cxx | 6 +++--- src/DatabaseGlue.hxx | 15 +++++++++++++++ src/Main.cxx | 7 ++++--- src/database.h | 14 -------------- 4 files changed, 22 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx index e0f39f7b..86810c2b 100644 --- a/src/DatabaseGlue.cxx +++ b/src/DatabaseGlue.cxx @@ -51,7 +51,7 @@ static bool db_is_open; static bool is_simple; bool -db_init(const struct config_param *param, GError **error_r) +DatabaseGlobalInit(const config_param *param, GError **error_r) { assert(db == NULL); assert(!db_is_open); @@ -72,7 +72,7 @@ db_init(const struct config_param *param, GError **error_r) } void -db_finish(void) +DatabaseGlobalDeinit(void) { if (db_is_open) db->Close(); @@ -142,7 +142,7 @@ db_save(GError **error_r) } bool -db_load(GError **error) +DatabaseGlobalOpen(GError **error) { assert(db != NULL); assert(!db_is_open); diff --git a/src/DatabaseGlue.hxx b/src/DatabaseGlue.hxx index b38ba595..ea26f324 100644 --- a/src/DatabaseGlue.hxx +++ b/src/DatabaseGlue.hxx @@ -23,8 +23,23 @@ #include "gcc.h" #include "gerror.h" +struct config_param; class Database; +/** + * Initialize the database library. + * + * @param param the database configuration block + */ +bool +DatabaseGlobalInit(const config_param *param, GError **error_r); + +void +DatabaseGlobalDeinit(void); + +bool +DatabaseGlobalOpen(GError **error); + /** * Returns the global #Database instance. May return NULL if this MPD * configuration has no database (no music_directory was configured). diff --git a/src/Main.cxx b/src/Main.cxx index 3d457e31..5e63f5f6 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -25,6 +25,7 @@ #include "StateFile.hxx" #include "PlayerThread.hxx" #include "Mapper.hxx" +#include "DatabaseGlue.hxx" extern "C" { #include "daemon.h" @@ -186,13 +187,13 @@ glue_db_init_and_load(void) param = allocated; } - if (!db_init(param, &error)) + if (!DatabaseGlobalInit(param, &error)) MPD_ERROR("%s", error->message); if (allocated != NULL) config_param_free(allocated); - ret = db_load(&error); + ret = DatabaseGlobalOpen(&error); if (!ret) MPD_ERROR("%s", error->message); @@ -520,7 +521,7 @@ int mpd_main(int argc, char *argv[]) playlist_global_finish(); start = clock(); - db_finish(); + DatabaseGlobalDeinit(); g_debug("db_finish took %f seconds", ((float)(clock()-start))/CLOCKS_PER_SEC); diff --git a/src/database.h b/src/database.h index 9cde50ba..ee2e609a 100644 --- a/src/database.h +++ b/src/database.h @@ -32,17 +32,6 @@ struct directory; struct db_selection; struct db_visitor; -/** - * Initialize the database library. - * - * @param param the database configuration block - */ -bool -db_init(const struct config_param *param, GError **error_r); - -void -db_finish(void); - /** * Check whether the default #SimpleDatabasePlugin is used. This * allows using db_get_root(), db_save(), db_get_mtime() and @@ -75,9 +64,6 @@ db_get_directory(const char *name); bool db_save(GError **error_r); -bool -db_load(GError **error); - /** * May only be used if db_is_simple() returns true. */ -- cgit v1.2.3