diff options
author | Max Kellermann <max@duempel.org> | 2013-01-04 01:17:25 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-04 01:17:25 +0100 |
commit | a7d1daee93446327b5a0c35d779880354cdbf66e (patch) | |
tree | cbf9c8013495c871474dc405e513e914dde0f151 /src/CommandListBuilder.hxx | |
parent | 77a99cc61d7a39745192354594086bb90ffb0b50 (diff) | |
download | mpd-a7d1daee93446327b5a0c35d779880354cdbf66e.tar.gz mpd-a7d1daee93446327b5a0c35d779880354cdbf66e.tar.xz mpd-a7d1daee93446327b5a0c35d779880354cdbf66e.zip |
CommandListBuilder: use std::list instead of GSList
Diffstat (limited to '')
-rw-r--r-- | src/CommandListBuilder.hxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/CommandListBuilder.hxx b/src/CommandListBuilder.hxx index cc9e7b158..a112ac33b 100644 --- a/src/CommandListBuilder.hxx +++ b/src/CommandListBuilder.hxx @@ -20,7 +20,9 @@ #ifndef MPD_COMMAND_LIST_BUILDER_HXX #define MPD_COMMAND_LIST_BUILDER_HXX -#include <glib.h> +#include <list> +#include <string> + #include <assert.h> class CommandListBuilder { @@ -47,7 +49,7 @@ class CommandListBuilder { /** * for when in list mode */ - GSList *list; + std::list<std::string> list; /** * Memory consumed by the list. @@ -56,10 +58,7 @@ class CommandListBuilder { public: CommandListBuilder() - :mode(Mode::DISABLED), list(nullptr), size(0) {} - ~CommandListBuilder() { - Reset(); - } + :mode(Mode::DISABLED), size(0) {} /** * Is a command list currently being built? @@ -86,7 +85,7 @@ public: * Begin building a command list. */ void Begin(bool ok) { - assert(list == nullptr); + assert(list.empty()); assert(mode == Mode::DISABLED); mode = (Mode)ok; @@ -100,13 +99,10 @@ public: /** * Finishes the list and returns it. */ - GSList *Commit() { + std::list<std::string> &&Commit() { assert(IsActive()); - /* for scalability reasons, we have prepended each new - command; now we have to reverse it to restore the - correct order */ - return list = g_slist_reverse(list); + return std::move(list); } }; |