aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-10-12 01:56:13 -0700
committerEric Wong <normalperson@yhbt.net>2008-10-12 05:27:33 -0700
commit085d139e21511109b0a38278baf20993c7edfa38 (patch)
tree9e30b08671e040ddd5cf41f8313a94cd65f96626
parenta9f0147852c6dd4e355ac339fc4e3f2186cdb155 (diff)
downloadmpd-085d139e21511109b0a38278baf20993c7edfa38.tar.gz
mpd-085d139e21511109b0a38278baf20993c7edfa38.tar.xz
mpd-085d139e21511109b0a38278baf20993c7edfa38.zip
update: remove delete_each_song and clear_directory
Our beefier directory_free takes care of it now in the main task.
-rw-r--r--src/update.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/src/update.c b/src/update.c
index b244c3a3b..9c0113446 100644
--- a/src/update.c
+++ b/src/update.c
@@ -86,26 +86,6 @@ static void delete_song(struct directory *dir, struct mpd_song *del)
serialized_delete(del, UPDATE_TYPE_SONG);
}
-static int delete_each_song(struct mpd_song *song, mpd_unused void *data)
-{
- struct directory *dir = data;
- assert(song->parent == dir);
- delete_song(dir, song);
- return 0;
-}
-
-/**
- * Recursively remove all sub directories and songs from a directory,
- * leaving an empty directory.
- */
-static int clear_directory(struct directory *dir, mpd_unused void *arg)
-{
- dirvec_for_each(&dir->children, clear_directory, NULL);
- dirvec_clear(&dir->children);
- songvec_for_each(&dir->songs, delete_each_song, dir);
- return 0;
-}
-
/**
* Recursively free a directory and all its contents.
*/
@@ -113,8 +93,10 @@ static void delete_directory(struct directory *dir)
{
assert(dir->parent != NULL);
- clear_directory(dir, NULL);
+ /* first, prevent traversers in main task from getting this */
dirvec_delete(&dir->parent->children, dir);
+
+ /* now we let the main task recursively delete everything under us */
serialized_delete(dir, UPDATE_TYPE_DIR);
}