diff options
author | Max Kellermann <max@duempel.org> | 2008-10-08 11:08:04 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-08 11:08:04 +0200 |
commit | 3b6efa99daf466f95407560b294fce5e5170ef63 (patch) | |
tree | 6afbd70440f84d1d60b44a83578b47ab4f30a4f5 | |
parent | 68977af6e078b7114195d098a89952b2c89274cd (diff) | |
download | mpd-3b6efa99daf466f95407560b294fce5e5170ef63.tar.gz mpd-3b6efa99daf466f95407560b294fce5e5170ef63.tar.xz mpd-3b6efa99daf466f95407560b294fce5e5170ef63.zip |
directory: directory_get_path(NULL) is not allowed
Also convert directory_get_path() to an inline function, which returns
a constant string.
-rw-r--r-- | src/directory.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/directory.h b/src/directory.h index b378a93f1..d8a8ea2af 100644 --- a/src/directory.h +++ b/src/directory.h @@ -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 |