diff options
author | Max Kellermann <max@duempel.org> | 2014-12-03 21:39:45 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-04 09:14:28 +0100 |
commit | e69bef3ce389967b8239648e4b9eaec42217bc95 (patch) | |
tree | 603870b6d042017c7a93f1909afc91395cf1415b /src/output/plugins/AoOutputPlugin.cxx | |
parent | c1c0fc79bcdc9caabe42fc3716ea2e2ea7b3eb3d (diff) | |
download | mpd-e69bef3ce389967b8239648e4b9eaec42217bc95.tar.gz mpd-e69bef3ce389967b8239648e4b9eaec42217bc95.tar.xz mpd-e69bef3ce389967b8239648e4b9eaec42217bc95.zip |
util/SplitString: new utility class
Replaces GLib's g_strsplit().
Diffstat (limited to 'src/output/plugins/AoOutputPlugin.cxx')
-rw-r--r-- | src/output/plugins/AoOutputPlugin.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/output/plugins/AoOutputPlugin.cxx b/src/output/plugins/AoOutputPlugin.cxx index 6faa30b1b..689e7de7c 100644 --- a/src/output/plugins/AoOutputPlugin.cxx +++ b/src/output/plugins/AoOutputPlugin.cxx @@ -21,12 +21,12 @@ #include "AoOutputPlugin.hxx" #include "../OutputAPI.hxx" #include "util/DivideString.hxx" +#include "util/SplitString.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "Log.hxx" #include <ao/ao.h> -#include <glib.h> #include <string.h> @@ -127,22 +127,18 @@ AoOutput::Configure(const config_param ¶m, Error &error) value = param.GetBlockValue("options", nullptr); if (value != nullptr) { - gchar **_options = g_strsplit(value, ";", 0); - - for (unsigned i = 0; _options[i] != nullptr; ++i) { - const DivideString ss(_options[i], '='); + for (const auto &i : SplitString(value, ';')) { + const DivideString ss(i.c_str(), '='); if (!ss.IsDefined()) { error.Format(ao_output_domain, "problems parsing options \"%s\"", - _options[i]); + i.c_str()); return false; } ao_append_option(&options, ss.GetFirst(), ss.GetSecond()); } - - g_strfreev(_options); } return true; |