diff options
author | Max Kellermann <max@duempel.org> | 2012-09-27 23:48:29 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-09-28 00:10:02 +0200 |
commit | 609f6ce66de4d100388531db5a420f155b7bf64d (patch) | |
tree | b2d4810436036634cbef7fe1fe30f1e41c832467 /src/PlaylistCommands.cxx | |
parent | 7298b6c84652a98140805f3d4c85c3d5263c407a (diff) | |
download | mpd-609f6ce66de4d100388531db5a420f155b7bf64d.tar.gz mpd-609f6ce66de4d100388531db5a420f155b7bf64d.tar.xz mpd-609f6ce66de4d100388531db5a420f155b7bf64d.zip |
PlaylistFile: use std::list instead of GPtrArray
Diffstat (limited to 'src/PlaylistCommands.cxx')
-rw-r--r-- | src/PlaylistCommands.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/PlaylistCommands.cxx b/src/PlaylistCommands.cxx index 108318c2f..f6f43f652 100644 --- a/src/PlaylistCommands.cxx +++ b/src/PlaylistCommands.cxx @@ -40,17 +40,13 @@ extern "C" { #include <stdlib.h> static void -print_spl_list(struct client *client, GPtrArray *list) +print_spl_list(struct client *client, const PlaylistFileList &list) { - for (unsigned i = 0; i < list->len; ++i) { - struct stored_playlist_info *playlist = - (struct stored_playlist_info *) - g_ptr_array_index(list, i); + for (const auto &i : list) { + client_printf(client, "playlist: %s\n", i.name.c_str()); - client_printf(client, "playlist: %s\n", playlist->name); - - if (playlist->mtime > 0) - time_print(client, "Last-Modified", playlist->mtime); + if (i.mtime > 0) + time_print(client, "Last-Modified", i.mtime); } } @@ -218,11 +214,10 @@ handle_listplaylists(struct client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { GError *error = NULL; - GPtrArray *list = spl_list(&error); - if (list == NULL) + const auto list = ListPlaylistFiles(&error); + if (list.empty() && error != NULL) return print_error(client, error); print_spl_list(client, list); - spl_list_free(list); return COMMAND_RETURN_OK; } |