aboutsummaryrefslogtreecommitdiffstats
path: root/src/update.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-09 15:34:07 +0200
committerEric Wong <normalperson@yhbt.net>2008-10-11 19:21:49 -0700
commit4a13e19cebb8d72db6e2db9ffb9f9dbd7194ede9 (patch)
treee6b44e7f6c3bc4e3d30f3b88739dfb4f37ee2a28 /src/update.c
parentf2052e7e2ffb5b8ecd15d96a766b5a162a39b2af (diff)
downloadmpd-4a13e19cebb8d72db6e2db9ffb9f9dbd7194ede9.tar.gz
mpd-4a13e19cebb8d72db6e2db9ffb9f9dbd7194ede9.tar.xz
mpd-4a13e19cebb8d72db6e2db9ffb9f9dbd7194ede9.zip
directory: added inline wrappers for accessing children
Some tiny utilities... wrappers like these may become helpful when we introduce locking.
Diffstat (limited to 'src/update.c')
-rw-r--r--src/update.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/update.c b/src/update.c
index 6e9f1572c..b44d07075 100644
--- a/src/update.c
+++ b/src/update.c
@@ -230,7 +230,7 @@ updateInDirectory(struct directory *directory, const char *name)
return UPDATE_RETURN_UPDATED;
}
} else if (S_ISDIR(st.st_mode)) {
- struct directory *subdir = dirvec_find(&directory->children, name);
+ struct directory *subdir = directory_get_child(directory, name);
if (subdir) {
assert(directory == subdir->parent);
directory_set_stat(subdir, &st);
@@ -318,17 +318,15 @@ static struct directory * addDirectoryPathToDB(const char *utf8path)
if (!parentDirectory)
return NULL;
- if ((directory = dirvec_find(&parentDirectory->children, utf8path))) {
+ if ((directory = directory_get_child(parentDirectory, utf8path))) {
assert(parentDirectory == directory->parent);
} else {
struct stat st;
if (myStat(utf8path, &st) < 0 ||
inodeFoundInParent(parentDirectory, st.st_ino, st.st_dev))
return NULL;
- else {
- directory = directory_new(utf8path, parentDirectory);
- dirvec_add(&parentDirectory->children, directory);
- }
+
+ directory = directory_new_child(parentDirectory, utf8path);
}
/* if we're adding directory paths, make sure to delete filenames