diff options
author | Max Kellermann <max@duempel.org> | 2011-09-13 20:38:12 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-09-13 20:44:35 +0200 |
commit | 412cf974a4cf3693cc643ab8ce0c1d733b7e8047 (patch) | |
tree | 05ad662892dd364b6c3466dfc860270cb4c8d944 /src/directory.c | |
parent | 3fc6beeff0c5bba90a458422c40af5ed0d6c81aa (diff) | |
download | mpd-412cf974a4cf3693cc643ab8ce0c1d733b7e8047.tar.gz mpd-412cf974a4cf3693cc643ab8ce0c1d733b7e8047.tar.xz mpd-412cf974a4cf3693cc643ab8ce0c1d733b7e8047.zip |
directory: don't visit "self" in _walk()
Let the caller decide if the current directory should be visited.
Diffstat (limited to 'src/directory.c')
-rw-r--r-- | src/directory.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/directory.c b/src/directory.c index 515b07e7d..83fefb8c4 100644 --- a/src/directory.c +++ b/src/directory.c @@ -177,10 +177,6 @@ directory_walk(struct directory *directory, assert(visitor != NULL); assert(error_r == NULL || *error_r == NULL); - if (visitor->directory != NULL && - !visitor->directory(directory, ctx, error_r)) - return false; - if (visitor->song != NULL) { struct songvec *sv = &directory->songs; for (size_t i = 0; i < sv->nr; ++i) @@ -192,6 +188,10 @@ directory_walk(struct directory *directory, for (size_t i = 0; i < dv->nr; ++i) { struct directory *child = dv->base[i]; + if (visitor->directory != NULL && + !visitor->directory(child, ctx, error_r)) + return false; + if (!directory_walk(child, visitor, ctx, error_r)) return false; } |