From a288922b6594c320d5f97e719745a483a70dccdf Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 28 Sep 2015 10:00:06 -0400 Subject: [PATCH] core/tags/library: Move library_find() out of the tags namespace Signed-off-by: Anna Schumaker --- core/library.cpp | 2 +- core/tags/library.cpp | 2 +- include/core/tags/library.h | 13 +++---------- tests/core/tags/library.cpp | 4 ++-- tests/core/tags/track.cpp | 2 +- 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/core/library.cpp b/core/library.cpp index 6d4532b0..c06098d5 100644 --- a/core/library.cpp +++ b/core/library.cpp @@ -182,7 +182,7 @@ struct library *collection :: add(const std::string &dir) if (g_file_test(dir.c_str(), G_FILE_TEST_IS_DIR) == false) return library; - library = tags :: get_library(dir); + library = library_find(dir); if (library) update(library); return library; diff --git a/core/tags/library.cpp b/core/tags/library.cpp index 01693029..bd058c23 100644 --- a/core/tags/library.cpp +++ b/core/tags/library.cpp @@ -73,7 +73,7 @@ void tags :: init_library_db() db_load(&library_db); } -struct library *tags :: get_library(const std::string &path) +struct library *library_find(const std::string &path) { return db_find(&library_db, path.c_str()); } diff --git a/include/core/tags/library.h b/include/core/tags/library.h index ff408908..1d601080 100644 --- a/include/core/tags/library.h +++ b/include/core/tags/library.h @@ -92,16 +92,6 @@ namespace tags /** Called to read the library_db from disk. */ void init_library_db(); - /** - * Called to look up a Library tag by library path. If no - * existing tag is found a new one will be created and - * returned to the caller. - * - * @param path The path to the library directory on disk. - * @return A matching Library tag. - */ - struct library *get_library(const std::string &); - /** * Called to remove a specific Library tag. * @@ -119,6 +109,9 @@ namespace tags } +/* Called to find a library tag by library path. */ +struct library *library_find(const std::string &); + /* Called to get a library tag with a specific index. */ struct library *library_get(const unsigned int); diff --git a/tests/core/tags/library.cpp b/tests/core/tags/library.cpp index fd77130d..41b29475 100644 --- a/tests/core/tags/library.cpp +++ b/tests/core/tags/library.cpp @@ -74,11 +74,11 @@ static void test_library_db() test_equal(tags :: library_size(), 0); tags :: init_library_db(); - library = tags :: get_library("/home/Zelda/Music"); + library = library_find("/home/Zelda/Music"); test_verify_zelda(library); test_equal(tags :: library_size(), 1); - test_equal(tags :: get_library("/home/Zelda/Music"), library); + test_equal(library_find("/home/Zelda/Music"), library); test_equal(library_get(0), library); test_equal(library_get(1), (struct library *)NULL); diff --git a/tests/core/tags/track.cpp b/tests/core/tags/track.cpp index 47b5d70b..c5ac0160 100644 --- a/tests/core/tags/track.cpp +++ b/tests/core/tags/track.cpp @@ -68,7 +68,7 @@ static void test_track_tag_constructor() album = album_find("Hyrule Symphony", 1998); artist = artist_find("Koji Kondo"); genre = genre_find("Video Game Music"); - library = tags :: get_library(MUSIC_DIR); + library = library_find(MUSIC_DIR); Track a(album, artist, genre, library, "Hyrule Symphony/13 - Legend of Zelda Medley.mp3",