Use mxs::strtok in readconnroute

The configuration can be simplified by using the string tokenization
function.
This commit is contained in:
Markus Mäkelä 2018-07-10 05:28:21 +03:00
parent e353d14550
commit f11f8980b2
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -171,21 +171,8 @@ static bool configureInstance(MXS_ROUTER* instance, MXS_CONFIG_PARAMETER* params
uint64_t bitmask = 0;
uint64_t bitvalue = 0;
bool ok = true;
std::string optstr = config_get_string(params, "router_options");
std::vector<std::string> options;
while (!optstr.empty())
{
size_t pos = optstr.find(',');
options.push_back(mxs::trimmed_copy(optstr.substr(0, pos)));
optstr.erase(0, pos);
if (pos != optstr.npos)
{
optstr.erase(0, 1);
}
}
for (auto&& opt: options)
for (auto&& opt: mxs::strtok(config_get_string(params, "router_options"), ", \t"))
{
if (!strcasecmp(opt.c_str(), "master"))
{