diff options
author | Max Kellermann <max@duempel.org> | 2013-01-29 18:51:40 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-29 20:32:54 +0100 |
commit | 8cad20585dbbf5987d6649bea9c6b6ba688b7bff (patch) | |
tree | b93e9dbd1e3f6e8f895ea53b2d5bfec09e6fab46 /src/playlist/PlsPlaylistPlugin.cxx | |
parent | a8b75dc4df3bf3ba9a1554249cf6d07527184864 (diff) | |
download | mpd-8cad20585dbbf5987d6649bea9c6b6ba688b7bff.tar.gz mpd-8cad20585dbbf5987d6649bea9c6b6ba688b7bff.tar.xz mpd-8cad20585dbbf5987d6649bea9c6b6ba688b7bff.zip |
playlist/memory: use std::forward_list instead of GSList
Diffstat (limited to 'src/playlist/PlsPlaylistPlugin.cxx')
-rw-r--r-- | src/playlist/PlsPlaylistPlugin.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx index cecabc88e..3cf5f46e5 100644 --- a/src/playlist/PlsPlaylistPlugin.cxx +++ b/src/playlist/PlsPlaylistPlugin.cxx @@ -27,11 +27,8 @@ #include <glib.h> -struct PlsPlaylist { - GSList *songs; -}; - -static void pls_parser(GKeyFile *keyfile, PlsPlaylist *playlist) +static void +pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) { gchar *key; gchar *value; @@ -96,7 +93,7 @@ static void pls_parser(GKeyFile *keyfile, PlsPlaylist *playlist) if(error) g_error_free(error); error = NULL; - playlist->songs = g_slist_prepend(playlist->songs, song); + songs.emplace_front(song); num_entries--; } @@ -150,13 +147,12 @@ pls_open_stream(struct input_stream *is) return NULL; } - PlsPlaylist playlist; - playlist.songs = nullptr; - - pls_parser(keyfile, &playlist); + std::forward_list<SongPointer> songs; + pls_parser(keyfile, songs); g_key_file_free(keyfile); - return new MemoryPlaylistProvider(g_slist_reverse(playlist.songs)); + songs.reverse(); + return new MemoryPlaylistProvider(std::move(songs)); } static const char *const pls_suffixes[] = { |