update: removed struct delete_data
The struct delete_data has only one member left and can be eliminated.
This commit is contained in:
parent
ff72fff68d
commit
6a008b52d1
12
src/update.c
12
src/update.c
@ -169,21 +169,17 @@ delete_name_in(struct directory *parent, const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct delete_data {
|
|
||||||
struct directory *dir;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* passed to songvec_for_each */
|
/* passed to songvec_for_each */
|
||||||
static int
|
static int
|
||||||
delete_song_if_removed(struct song *song, void *_data)
|
delete_song_if_removed(struct song *song, void *_data)
|
||||||
{
|
{
|
||||||
struct delete_data *data = _data;
|
struct directory *dir = _data;
|
||||||
char *path;
|
char *path;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if ((path = map_song_fs(song)) == NULL ||
|
if ((path = map_song_fs(song)) == NULL ||
|
||||||
stat(path, &st) < 0 || !S_ISREG(st.st_mode)) {
|
stat(path, &st) < 0 || !S_ISREG(st.st_mode)) {
|
||||||
delete_song(data->dir, song);
|
delete_song(dir, song);
|
||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,7 +209,6 @@ removeDeletedFromDirectory(struct directory *directory)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct dirvec *dv = &directory->children;
|
struct dirvec *dv = &directory->children;
|
||||||
struct delete_data data;
|
|
||||||
|
|
||||||
for (i = dv->nr; --i >= 0; ) {
|
for (i = dv->nr; --i >= 0; ) {
|
||||||
if (directory_exists(dv->base[i]))
|
if (directory_exists(dv->base[i]))
|
||||||
@ -224,8 +219,7 @@ removeDeletedFromDirectory(struct directory *directory)
|
|||||||
modified = true;
|
modified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.dir = directory;
|
songvec_for_each(&directory->songs, delete_song_if_removed, directory);
|
||||||
songvec_for_each(&directory->songs, delete_song_if_removed, &data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user