core/tags/album: Move album_db_init() out of the tags namespace

And add the function album_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-09-24 11:18:48 -04:00
parent 0fa2d8acc2
commit abe12bac64
4 changed files with 13 additions and 9 deletions

View File

@ -63,12 +63,17 @@ unsigned int album :: year()
}
void tags :: init_album_db()
void album_db_init()
{
db_init(&album_db, "album.db", true);
db_load(&album_db);
}
void album_db_deinit()
{
db_deinit(&album_db);
}
struct album *album_find(const std::string &name, unsigned int year)
{
return db_find(&album_db, make_key(name, year).c_str());

View File

@ -10,7 +10,7 @@
void tags :: init()
{
tags :: init_album_db();
album_db_init();
tags :: init_artist_db();
tags :: init_genre_db();
tags :: init_library_db();

View File

@ -62,14 +62,12 @@ struct album : public GenericTag {
unsigned int year();
};
namespace tags
{
/** Called to read the album_db from disk. */
void init_album_db();
} /* Namespace: tags */
/* Called to initialize the album database. */
void album_db_init();
/* Called to clean up the album database. */
void album_db_deinit();
/* Called to find an album tag by name and year. */
struct album *album_find(const std::string &, unsigned int);

View File

@ -65,7 +65,7 @@ static void test_album_db()
database<struct album> album_db;
struct album *album;
tags :: init_album_db();
album_db_init();
album = album_find("Hyrule Symphony", 1998);
test_verify_hyrule(album);
@ -79,6 +79,7 @@ static void test_album_db()
test_equal(album_db.db_size, 1);
db_deinit(&album_db);
album_db_deinit();
}
DECLARE_UNIT_TESTS(