directory: added inline wrappers for accessing children
Some tiny utilities... wrappers like these may become helpful when we introduce locking.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user