diff options
author | Max Kellermann <max@duempel.org> | 2013-01-03 18:07:48 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-03 18:07:48 +0100 |
commit | 59400d38a99ac8ffbfd7d89e021ed2f56ffbfd23 (patch) | |
tree | 58d15f2651250942d8ff46fd1a43520168e33595 /src/MessageCommands.cxx | |
parent | 5155b0f6087b5929838f6594a719011e3e704244 (diff) | |
download | mpd-59400d38a99ac8ffbfd7d89e021ed2f56ffbfd23.tar.gz mpd-59400d38a99ac8ffbfd7d89e021ed2f56ffbfd23.tar.xz mpd-59400d38a99ac8ffbfd7d89e021ed2f56ffbfd23.zip |
Client: use std::deque for messages
Diffstat (limited to '')
-rw-r--r-- | src/MessageCommands.cxx | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/MessageCommands.cxx b/src/MessageCommands.cxx index 738c2eab9..c5f4d79b0 100644 --- a/src/MessageCommands.cxx +++ b/src/MessageCommands.cxx @@ -109,19 +109,14 @@ handle_read_messages(Client *client, { assert(argc == 1); - GSList *messages = client_read_messages(client); - - for (GSList *i = messages; i != NULL; i = g_slist_next(i)) { - ClientMessage *msg = (ClientMessage *)i->data; + while (!client->messages.empty()) { + const ClientMessage &msg = client->messages.front(); client_printf(client, "channel: %s\nmessage: %s\n", - msg->GetChannel(), - msg->GetMessage()); - delete msg; + msg.GetChannel(), msg.GetMessage()); + client->messages.pop_front(); } - g_slist_free(messages); - return COMMAND_RETURN_OK; } |