aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-08 11:06:44 +0200
committerMax Kellermann <max@duempel.org>2008-10-08 11:06:44 +0200
commitba5c9b0375b84456553b9b57cb68cb204c1d9418 (patch)
tree459d20c7a4e0f078110c6007940ff2a8593fd10a /src/directory.c
parente1a4474ad4a0bc78ac338223b0528e0161f38e98 (diff)
downloadmpd-ba5c9b0375b84456553b9b57cb68cb204c1d9418.tar.gz
mpd-ba5c9b0375b84456553b9b57cb68cb204c1d9418.tar.xz
mpd-ba5c9b0375b84456553b9b57cb68cb204c1d9418.zip
directory: converted isRootDirectory() to an inline function
The function isRootDirectory() is tiny and can be converted to an inline function. Don't allow name==NULL.
Diffstat (limited to '')
-rw-r--r--src/directory.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/directory.c b/src/directory.c
index af00b90f3..b8e6fa1f0 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -101,11 +101,6 @@ void directory_finish(void)
freeDirectory(music_root);
}
-int isRootDirectory(const char *name)
-{
- return (!name || name[0] == '\0' || !strcmp(name, "/"));
-}
-
struct directory *
directory_get_root(void)
{
@@ -122,6 +117,8 @@ getSubDirectory(struct directory * directory, const char *name)
char *duplicated;
char *locate;
+ assert(name != NULL);
+
if (isRootDirectory(name))
return directory;
@@ -148,6 +145,9 @@ getSubDirectory(struct directory * directory, const char *name)
struct directory *
getDirectory(const char *name)
{
+ if (name == NULL)
+ return music_root;
+
return getSubDirectory(music_root, name);
}