diff options
author | Max Kellermann <max@duempel.org> | 2008-10-09 15:34:07 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-09 15:34:07 +0200 |
commit | cbc076461371fca57749191fb323cf75b43d9544 (patch) | |
tree | cbeb77d790debcf46ad4ba7aaabaa3597927a06b /src/directory.h | |
parent | a5480108f8c834a1db3b5c4f30a7dd7e9569776e (diff) | |
download | mpd-cbc076461371fca57749191fb323cf75b43d9544.tar.gz mpd-cbc076461371fca57749191fb323cf75b43d9544.tar.xz mpd-cbc076461371fca57749191fb323cf75b43d9544.zip |
directory: added inline wrappers for accessing children
Some tiny utilities... wrappers like these may become helpful when we
introduce locking.
Diffstat (limited to '')
-rw-r--r-- | src/directory.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/directory.h b/src/directory.h index 14bda5b58..9dd064ef7 100644 --- a/src/directory.h +++ b/src/directory.h @@ -68,6 +68,20 @@ directory_get_path(struct directory *directory) return directory->path; } +static inline struct directory * +directory_get_child(const struct directory *directory, const char *name) +{ + return dirvec_find(&directory->children, name); +} + +static inline struct directory * +directory_new_child(struct directory *directory, const char *name) +{ + struct directory *subdir = directory_new(name, directory); + dirvec_add(&directory->children, subdir); + return subdir; +} + void directory_prune_empty(struct directory *directory); |