diff options
author | Max Kellermann <max@duempel.org> | 2014-02-04 08:57:40 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-04 09:05:32 +0100 |
commit | f25ef8d6825c03aec4569c6ad4b9bfb3a9f5d78d (patch) | |
tree | f0ad647783c635c72bd7004b34dbae01ad2d3970 /src/db/update/Walk.cxx | |
parent | 33a2c01ea2e6c06922eb0ce6a8f08760206138b4 (diff) | |
download | mpd-f25ef8d6825c03aec4569c6ad4b9bfb3a9f5d78d.tar.gz mpd-f25ef8d6825c03aec4569c6ad4b9bfb3a9f5d78d.tar.xz mpd-f25ef8d6825c03aec4569c6ad4b9bfb3a9f5d78d.zip |
db/update/Walk: add Directory reference parameter
Remove dependency on the DatabaseSimple library.
Diffstat (limited to '')
-rw-r--r-- | src/db/update/Walk.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx index ff59fe960..ed09c1676 100644 --- a/src/db/update/Walk.cxx +++ b/src/db/update/Walk.cxx @@ -23,7 +23,6 @@ #include "Editor.hxx" #include "UpdateDomain.hxx" #include "db/DatabaseLock.hxx" -#include "db/DatabaseSimple.hxx" #include "db/Directory.hxx" #include "db/Song.hxx" #include "db/PlaylistVector.hxx" @@ -393,9 +392,9 @@ UpdateWalk::DirectoryMakeChildChecked(Directory &parent, const char *name_utf8) } inline Directory * -UpdateWalk::DirectoryMakeUriParentChecked(const char *uri) +UpdateWalk::DirectoryMakeUriParentChecked(Directory &root, const char *uri) { - Directory *directory = db_get_root(); + Directory *directory = &root; char *duplicated = xstrdup(uri); char *name_utf8 = duplicated, *slash; @@ -418,9 +417,9 @@ UpdateWalk::DirectoryMakeUriParentChecked(const char *uri) } inline void -UpdateWalk::UpdateUri(const char *uri) +UpdateWalk::UpdateUri(Directory &root, const char *uri) { - Directory *parent = DirectoryMakeUriParentChecked(uri); + Directory *parent = DirectoryMakeUriParentChecked(root, uri); if (parent == nullptr) return; @@ -435,19 +434,18 @@ UpdateWalk::UpdateUri(const char *uri) } bool -UpdateWalk::Walk(const char *path, bool discard) +UpdateWalk::Walk(Directory &root, const char *path, bool discard) { walk_discard = discard; modified = false; if (path != nullptr && !isRootDirectory(path)) { - UpdateUri(path); + UpdateUri(root, path); } else { - Directory *directory = db_get_root(); struct stat st; - if (stat_directory(*directory, &st) == 0) - UpdateDirectory(*directory, &st); + if (stat_directory(root, &st) == 0) + UpdateDirectory(root, &st); } return modified; |