diff options
author | Max Kellermann <max@duempel.org> | 2013-01-03 00:24:45 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-03 01:04:18 +0100 |
commit | d3293b889d20433adede6a248582ce778e1c87b8 (patch) | |
tree | 005c50fe1c81aae34aea2cd320e1f12e09a3c3aa /src | |
parent | b4b0b34e5a131f02f723f40cf9566cc43e37cf85 (diff) | |
download | mpd-d3293b889d20433adede6a248582ce778e1c87b8.tar.gz mpd-d3293b889d20433adede6a248582ce778e1c87b8.tar.xz mpd-d3293b889d20433adede6a248582ce778e1c87b8.zip |
database.h: move prototypes to DatabaseGlue.hxx
Diffstat (limited to 'src')
-rw-r--r-- | src/DatabaseGlue.cxx | 6 | ||||
-rw-r--r-- | src/DatabaseGlue.hxx | 15 | ||||
-rw-r--r-- | src/Main.cxx | 7 | ||||
-rw-r--r-- | src/database.h | 14 |
4 files changed, 22 insertions, 20 deletions
diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx index e0f39f7b9..86810c2bd 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 b38ba595a..ea26f3242 100644 --- a/src/DatabaseGlue.hxx +++ b/src/DatabaseGlue.hxx @@ -23,9 +23,24 @@ #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 3d457e31e..5e63f5f67 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 9cde50ba1..ee2e609a6 100644 --- a/src/database.h +++ b/src/database.h @@ -33,17 +33,6 @@ 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 * db_exists(). @@ -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. */ |