From e79aacf1db334ba920de0732631e999ab8144721 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 10:48:49 +0200 Subject: directory: added directory_is_empty() directory_is_empty() is a tiny inline function which determine if a directory has any child objects (sub directories or songs). --- src/directory.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/directory.h') 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 + 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); -- cgit v1.2.3