diff options
author | Max Kellermann <max@duempel.org> | 2009-04-01 18:41:33 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-04-01 18:41:33 +0200 |
commit | 36ec2edacfbf17b5308312ad5617117685004174 (patch) | |
tree | 6d6be9a0e5eef2caee320537aab2a516c63a8435 /src | |
parent | 932f70da8631f12269f8b717eb2ed7b487f7a90e (diff) | |
download | mpd-36ec2edacfbf17b5308312ad5617117685004174.tar.gz mpd-36ec2edacfbf17b5308312ad5617117685004174.tar.xz mpd-36ec2edacfbf17b5308312ad5617117685004174.zip |
directory: renamed directory_get_directory()
Renamed directory_get_directory() to directory_lookup_directory().
Added API documentation.
Diffstat (limited to '')
-rw-r--r-- | src/database.c | 2 | ||||
-rw-r--r-- | src/directory.c | 8 | ||||
-rw-r--r-- | src/directory.h | 9 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/database.c b/src/database.c index a6ae59f62..94527e72d 100644 --- a/src/database.c +++ b/src/database.c @@ -104,7 +104,7 @@ db_get_directory(const char *name) if (name == NULL) return music_root; - return directory_get_directory(music_root, name); + return directory_lookup_directory(music_root, name); } struct song * diff --git a/src/directory.c b/src/directory.c index 039bdcbe1..ef2cd1c2c 100644 --- a/src/directory.c +++ b/src/directory.c @@ -82,19 +82,19 @@ directory_prune_empty(struct directory *directory) } struct directory * -directory_get_directory(struct directory *directory, const char *name) +directory_lookup_directory(struct directory *directory, const char *uri) { struct directory *cur = directory; struct directory *found = NULL; char *duplicated; char *locate; - assert(name != NULL); + assert(uri != NULL); - if (isRootDirectory(name)) + if (isRootDirectory(uri)) return directory; - duplicated = g_strdup(name); + duplicated = g_strdup(uri); locate = strchr(duplicated, '/'); while (1) { if (locate) diff --git a/src/directory.h b/src/directory.h index 592d5cbb0..cd5c53dfb 100644 --- a/src/directory.h +++ b/src/directory.h @@ -98,8 +98,15 @@ directory_new_child(struct directory *directory, const char *name) void directory_prune_empty(struct directory *directory); +/** + * Looks up a directory by its relative URI. + * + * @param directory the parent (or grandparent, ...) directory + * @param uri the relative URI + * @return the directory, or NULL if none was found + */ struct directory * -directory_get_directory(struct directory *directory, const char *name); +directory_lookup_directory(struct directory *directory, const char *uri); void directory_sort(struct directory *directory); |