aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/directory.c2
-rw-r--r--src/directory.h8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/directory.c b/src/directory.c
index 9913154e2..d1f0e3300 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -89,7 +89,7 @@ static void deleteEmptyDirectoriesInDirectory(Directory * directory)
for (i = dv->nr; --i >= 0; ) {
deleteEmptyDirectoriesInDirectory(dv->base[i]);
- if (!dv->base[i]->children.nr && !dv->base[i]->songs.nr)
+ if (directory_is_empty(dv->base[i]))
dirvec_delete(dv, dv->base[i]);
}
if (!dv->nr)
diff --git a/src/directory.h b/src/directory.h
index 44e6f63d5..e197600d1 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -23,6 +23,8 @@
#include "songvec.h"
#include "list.h"
+#include <stdbool.h>
+
struct dirvec {
struct _Directory **base;
size_t nr;
@@ -53,6 +55,12 @@ newDirectory(const char *dirname, Directory * parent);
void
freeDirectory(Directory * directory);
+static inline bool
+directory_is_empty(Directory *directory)
+{
+ return directory->children.nr == 0 && directory->songs.nr == 0;
+}
+
Directory *
getDirectory(const char *name);