From 3b6efa99daf466f95407560b294fce5e5170ef63 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Oct 2008 11:08:04 +0200 Subject: directory: directory_get_path(NULL) is not allowed Also convert directory_get_path() to an inline function, which returns a constant string. --- src/directory.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3