diff options
author | Max Kellermann <max@duempel.org> | 2008-10-07 22:10:42 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-07 22:10:42 +0200 |
commit | c47f97e1dc6a37459f90daf78a35c1751ea090e3 (patch) | |
tree | 099a0f87789f4b690b43d1b5fb6f4e3c086f4cd0 /src/song_print.c | |
parent | f0366cc8ca8c42063d18196fca757017a4390f88 (diff) | |
download | mpd-c47f97e1dc6a37459f90daf78a35c1751ea090e3.tar.gz mpd-c47f97e1dc6a37459f90daf78a35c1751ea090e3.tar.xz mpd-c47f97e1dc6a37459f90daf78a35c1751ea090e3.zip |
song: use songvec_for_each() in songvec_print() / songvec_save()
songvec_for_each() has locking, use it instead of manually iterating
over the songvec items.
Diffstat (limited to 'src/song_print.c')
-rw-r--r-- | src/song_print.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/song_print.c b/src/song_print.c index 3b4275472..647e6d594 100644 --- a/src/song_print.c +++ b/src/song_print.c @@ -42,14 +42,14 @@ int song_print_info(struct client *client, Song * song) return 0; } -int songvec_print(struct client *client, const struct songvec *sv) +static int +song_print_info_x(Song *song, void *data) { - int i; - Song **sp = sv->base; - - for (i = sv->nr; --i >= 0;) - if (song_print_info(client, *sp++) < 0) - return -1; + struct client *client = data; + return song_print_info(client, song); +} - return 0; +int songvec_print(struct client *client, const struct songvec *sv) +{ + return songvec_for_each(sv, song_print_info_x, client); } |