aboutsummaryrefslogtreecommitdiffstats
path: root/src/db
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-02 23:06:10 +0100
committerMax Kellermann <max@duempel.org>2013-01-02 23:06:10 +0100
commit0eb05b827fc239854773b43baff82581d65f9c5b (patch)
treec4f5d1aba7b4aad89826707310b6b75573453408 /src/db
parent0c245bc2712f5d38507b8d421cdc0a7e002a3398 (diff)
downloadmpd-0eb05b827fc239854773b43baff82581d65f9c5b.tar.gz
mpd-0eb05b827fc239854773b43baff82581d65f9c5b.tar.xz
mpd-0eb05b827fc239854773b43baff82581d65f9c5b.zip
Directory: turn functions to methods
Diffstat (limited to 'src/db')
-rw-r--r--src/db/ProxyDatabasePlugin.cxx8
-rw-r--r--src/db/SimpleDatabasePlugin.cxx22
2 files changed, 14 insertions, 16 deletions
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx
index 95aefc14f..938440046 100644
--- a/src/db/ProxyDatabasePlugin.cxx
+++ b/src/db/ProxyDatabasePlugin.cxx
@@ -168,7 +168,7 @@ ProxyDatabase::Open(GError **error_r)
return false;
}
- root = directory_new_root();
+ root = directory::NewRoot();
return true;
}
@@ -178,7 +178,7 @@ ProxyDatabase::Close()
{
assert(connection != nullptr);
- directory_free(root);
+ root->Free();
mpd_connection_free(connection);
}
@@ -241,9 +241,9 @@ Visit(struct mpd_connection *connection,
if (visit_directory) {
struct directory *d =
- directory_new(path, &detached_root);
+ directory::NewGeneric(path, &detached_root);
bool success = visit_directory(*d, error_r);
- directory_free(d);
+ d->Free();
if (!success)
return false;
}
diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/SimpleDatabasePlugin.cxx
index 06a92604f..ac2de1b61 100644
--- a/src/db/SimpleDatabasePlugin.cxx
+++ b/src/db/SimpleDatabasePlugin.cxx
@@ -180,7 +180,7 @@ SimpleDatabase::Load(GError **error_r)
bool
SimpleDatabase::Open(GError **error_r)
{
- root = directory_new_root();
+ root = directory::NewRoot();
mtime = 0;
#ifndef NDEBUG
@@ -189,7 +189,7 @@ SimpleDatabase::Open(GError **error_r)
GError *error = NULL;
if (!Load(&error)) {
- directory_free(root);
+ root->Free();
g_warning("Failed to load database: %s", error->message);
g_error_free(error);
@@ -197,7 +197,7 @@ SimpleDatabase::Open(GError **error_r)
if (!Check(error_r))
return false;
- root = directory_new_root();
+ root = directory::NewRoot();
}
return true;
@@ -209,7 +209,7 @@ SimpleDatabase::Close()
assert(root != NULL);
assert(borrowed_song_count == 0);
- directory_free(root);
+ root->Free();
}
struct song *
@@ -218,7 +218,7 @@ SimpleDatabase::GetSong(const char *uri, GError **error_r) const
assert(root != NULL);
db_lock();
- struct song *song = directory_lookup_song(root, uri);
+ song *song = root->LookupSong(uri);
db_unlock();
if (song == NULL)
g_set_error(error_r, db_quark(), DB_NOT_FOUND,
@@ -250,7 +250,7 @@ SimpleDatabase::LookupDirectory(const char *uri) const
assert(uri != NULL);
ScopeDatabaseLock protect;
- return directory_lookup_directory(root, uri);
+ return root->LookupDirectory(uri);
}
bool
@@ -262,12 +262,10 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
{
ScopeDatabaseLock protect;
- const struct directory *directory =
- directory_lookup_directory(root, selection.uri);
+ const directory *directory = root->LookupDirectory(selection.uri);
if (directory == NULL) {
if (visit_song) {
- struct song *song =
- directory_lookup_song(root, selection.uri);
+ song *song = root->LookupSong(selection.uri);
if (song != nullptr)
return !selection.Match(*song) ||
visit_song(*song, error_r);
@@ -310,10 +308,10 @@ SimpleDatabase::Save(GError **error_r)
db_lock();
g_debug("removing empty directories from DB");
- directory_prune_empty(root);
+ root->PruneEmpty();
g_debug("sorting DB");
- directory_sort(root);
+ root->Sort();
db_unlock();