Commit 412cf974 authored by Max Kellermann's avatar Max Kellermann

directory: don't visit "self" in _walk()

Let the caller decide if the current directory should be visited.
parent 3fc6beef
......@@ -128,6 +128,10 @@ db_walk(const char *uri,
return false;
}
if (visitor->directory != NULL &&
!visitor->directory(directory, ctx, error_r))
return false;
return directory_walk(directory, visitor, ctx, error_r);
}
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment