Code

playlist: don't check mpd_song_get_uri()!=NULL
authorMax Kellermann <max@duempel.org>
Tue, 29 Sep 2009 20:01:37 +0000 (22:01 +0200)
committerMax Kellermann <max@duempel.org>
Tue, 29 Sep 2009 20:01:37 +0000 (22:01 +0200)
libmpdclient2 guarantees that each mpd_song object has an URI.

src/playlist.c

index 38a39abadc594f7293bb60fab3cef765ac2e864b..713d3c69fc4b7902c17a45b32d1dc152778f8a00 100644 (file)
@@ -117,10 +117,9 @@ playlist_get_index_from_file(const struct mpdclient *c, const gchar *filename)
        guint i;
 
        for (i = 0; i < c->playlist.list->len; ++i) {
-               struct mpd_song *song = playlist_get(&c->playlist, i);
-               const char *uri = mpd_song_get_uri(song);
+               const struct mpd_song *song = playlist_get(&c->playlist, i);
 
-               if (uri != NULL && strcmp(uri, filename) == 0)
+               if (strcmp(mpd_song_get_uri(song), filename) == 0)
                        return (gint)i;
        }