directory: directory_get_path(NULL) is not allowed

Also convert directory_get_path() to an inline function, which returns
a constant string.
This commit is contained in:
Max Kellermann 2008-10-08 11:08:04 +02:00
parent 68977af6e0
commit 3b6efa99da

View File

@ -70,6 +70,14 @@ directory_is_empty(struct directory *directory)
return directory->children.nr == 0 && directory->songs.nr == 0;
}
static inline const char *
directory_get_path(struct directory *directory)
{
if (directory->path == NULL)
return "";
return directory->path;
}
void
directory_prune_empty(struct directory *directory);
@ -94,6 +102,4 @@ directory_walk(struct directory *directory,
int (*forEachDir)(struct directory *, void *),
void *data);
#define directory_get_path(dir) ((dir && dir->path) ? dir->path : "")
#endif