Commit ae4fd576 authored by Max Kellermann's avatar Max Kellermann

output/ao: use IterableSplitString() instead of SplitString()

parent 747436b1
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "thread/SafeSingleton.hxx" #include "thread/SafeSingleton.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
#include "util/DivideString.hxx" #include "util/DivideString.hxx"
#include "util/SplitString.hxx" #include "util/IterableSplitString.hxx"
#include "util/RuntimeError.hxx" #include "util/RuntimeError.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
...@@ -122,14 +122,16 @@ AoOutput::AoOutput(const ConfigBlock &block) ...@@ -122,14 +122,16 @@ AoOutput::AoOutput(const ConfigBlock &block)
value = block.GetBlockValue("options", nullptr); value = block.GetBlockValue("options", nullptr);
if (value != nullptr) { if (value != nullptr) {
for (const auto &i : SplitString(value, ';')) { for (StringView i : IterableSplitString(value, ';')) {
const DivideString ss(i.c_str(), '=', true); i.Strip();
if (!ss.IsDefined()) auto s = i.Split('=');
throw FormatRuntimeError("problems parsing options \"%s\"", if (s.first.empty() || s.second.IsNull())
i.c_str()); throw FormatRuntimeError("problems parsing option \"%.*s\"",
int(i.size), i.data);
ao_append_option(&options, ss.GetFirst(), ss.GetSecond()); const std::string n(s.first), v(s.second);
ao_append_option(&options, n.c_str(), v.c_str());
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment