core/tags/artist: Move artist_db_init() out of the tags namespace

And add the function artist_db_deinit().

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2015-10-22 13:06:12 -04:00
parent 52886c926e
commit 405ff0cf88
4 changed files with 13 additions and 9 deletions

View File

@ -15,12 +15,17 @@ artist :: artist(const std::string &name)
}
void tags :: init_artist_db()
void artist_db_init()
{
db_init(&artist_db, "artist.db", true);
db_load(&artist_db);
}
void artist_db_deinit()
{
db_deinit(&artist_db);
}
struct artist *artist_find(const std::string &name)
{
return db_find(&artist_db, name.c_str());

View File

@ -11,7 +11,7 @@
void tags :: init()
{
album_db_init();
tags :: init_artist_db();
artist_db_init();
tags :: init_genre_db();
tags :: init_library_db();
tags :: init_track_db();

View File

@ -21,14 +21,12 @@ struct artist : public GenericTag {
artist(const std::string &);
};
namespace tags
{
/** Called to read the artist_db from disk. */
void init_artist_db();
} /* Namespace: tags */
/* Called to initialize the artist database. */
void artist_db_init();
/* Called to clean up the artist database. */
void artist_db_deinit();
/* Called to find an artist tag by name. */
struct artist *artist_find(const std::string &);

View File

@ -66,7 +66,7 @@ static void test_artist_db()
database<struct artist> artist_db;
struct artist *artist;
tags :: init_artist_db();
artist_db_init();
artist = artist_find("Koji Kondo");
test_verify_koji(artist);
@ -80,6 +80,7 @@ static void test_artist_db()
test_equal(artist_db.db_size, 1);
db_deinit(&artist_db);
artist_db_deinit();
}
DECLARE_UNIT_TESTS(