aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-10 18:48:10 +0200
committerMax Kellermann <max@duempel.org>2011-09-13 21:47:00 +0200
commita94d4be466ea3a48389361b483f72df45834f7d2 (patch)
tree734076ad49d963a00648f58dee4cde111dc0364a /src/directory.c
parentb7d2d4cfe8b88174a7b1f41840ddc0b23dbd6a75 (diff)
downloadmpd-a94d4be466ea3a48389361b483f72df45834f7d2.tar.gz
mpd-a94d4be466ea3a48389361b483f72df45834f7d2.tar.xz
mpd-a94d4be466ea3a48389361b483f72df45834f7d2.zip
db_plugin: add method visit()
Diffstat (limited to '')
-rw-r--r--src/directory.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/directory.c b/src/directory.c
index 83fefb8c4..e6ccc60b7 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -169,7 +169,7 @@ directory_sort(struct directory *directory)
}
bool
-directory_walk(struct directory *directory,
+directory_walk(const struct directory *directory, bool recursive,
const struct db_visitor *visitor, void *ctx,
GError **error_r)
{
@@ -178,7 +178,7 @@ directory_walk(struct directory *directory,
assert(error_r == NULL || *error_r == NULL);
if (visitor->song != NULL) {
- struct songvec *sv = &directory->songs;
+ const struct songvec *sv = &directory->songs;
for (size_t i = 0; i < sv->nr; ++i)
if (!visitor->song(sv->base[i], ctx, error_r))
return false;
@@ -192,7 +192,8 @@ directory_walk(struct directory *directory,
!visitor->directory(child, ctx, error_r))
return false;
- if (!directory_walk(child, visitor, ctx, error_r))
+ if (recursive &&
+ !directory_walk(child, recursive, visitor, ctx, error_r))
return false;
}