Commit d3293b88 authored by Max Kellermann's avatar Max Kellermann

database.h: move prototypes to DatabaseGlue.hxx

parent b4b0b34e
......@@ -224,7 +224,7 @@ src_mpd_SOURCES = \
src/decoder_print.c \
src/Directory.cxx src/Directory.hxx \
src/DirectorySave.cxx src/DirectorySave.hxx \
src/DatabaseGlue.cxx \
src/DatabaseGlue.cxx src/DatabaseGlue.hxx \
src/DatabasePrint.cxx src/DatabasePrint.hxx \
src/DatabaseQueue.cxx src/DatabaseQueue.hxx \
src/DatabasePlaylist.cxx src/DatabasePlaylist.hxx \
......
......@@ -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);
......
......@@ -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).
*/
......
......@@ -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);
......
......@@ -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.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment