aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-13 16:46:51 +0200
committerMax Kellermann <max@duempel.org>2008-10-13 16:46:51 +0200
commit270a6ebd693d27ed712362f6c9ffa66cabd8d037 (patch)
tree7673c92578e9ff05c63f27f05454ff544f3aeddf /src
parent3e9ed15e76550f23233c7bb78ec1e609e6f2a0e3 (diff)
downloadmpd-270a6ebd693d27ed712362f6c9ffa66cabd8d037.tar.gz
mpd-270a6ebd693d27ed712362f6c9ffa66cabd8d037.tar.xz
mpd-270a6ebd693d27ed712362f6c9ffa66cabd8d037.zip
update: moved code to make_subdir()
Diffstat (limited to 'src')
-rw-r--r--src/update.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/update.c b/src/update.c
index 52c87bbfd..1ed673f64 100644
--- a/src/update.c
+++ b/src/update.c
@@ -235,6 +235,18 @@ inodeFoundInParent(struct directory *parent, ino_t inode, dev_t device)
return 0;
}
+static struct directory *
+make_subdir(struct directory *parent, const char *name)
+{
+ struct directory *directory;
+
+ directory = directory_get_child(parent, name);
+ if (directory == NULL)
+ directory = directory_new_child(parent, name);
+
+ return directory;
+}
+
static bool
updateDirectory(struct directory *directory, const struct stat *st);
@@ -267,10 +279,7 @@ updateInDirectory(struct directory *directory,
if (inodeFoundInParent(directory, st->st_ino, st->st_dev))
return;
- subdir = directory_get_child(directory, name);
- if (subdir == NULL)
- subdir = directory_new_child(directory, name);
-
+ subdir = make_subdir(directory, name);
assert(directory == subdir->parent);
ret = updateDirectory(subdir, st);