Code

playlist: don't update the song positions in playlist_swap()
authorMax Kellermann <max@duempel.org>
Sun, 18 Oct 2009 00:00:01 +0000 (02:00 +0200)
committerMax Kellermann <max@duempel.org>
Sun, 18 Oct 2009 00:00:01 +0000 (02:00 +0200)
In ncmpc, nobody reads the song's "position" attribute (except for the
"plchanges" handler).  We don't need it, and we don't need to update
it after a swap.

src/playlist.h

index 6f54736b1f22e6256e8cbabc2eebceeea1d39647..45046880869d3c545f42158c767c8dd32b3f8ad9 100644 (file)
@@ -107,12 +107,6 @@ playlist_swap(struct mpdclient_playlist *playlist, guint idx1, guint idx2)
 {
        struct mpd_song *song1 = playlist_get(playlist, idx1);
        struct mpd_song *song2 = playlist_get(playlist, idx2);
-       int n;
-
-       /* update the songs position field */
-       n = mpd_song_get_pos(song1);
-       mpd_song_set_pos(song1, mpd_song_get_pos(song2));
-       mpd_song_set_pos(song2, n);
 
        /* update the array */
        g_ptr_array_index(playlist->list, idx1) = song2;