Merge branch '2.3' into develop

This commit is contained in:
Markus Mäkelä
2019-04-12 13:23:49 +03:00
31 changed files with 625 additions and 243 deletions

View File

@ -1458,9 +1458,16 @@ std::string get_canonical(GWBUF* querybuf)
break;
}
}
else if (is_space(*it) && (i == 0 || is_space(rval[i - 1])))
else if (is_space(*it))
{
// Repeating space, skip it
if (i == 0 || is_space(rval[i - 1]))
{
// Leading or repeating whitespace, skip it
}
else
{
rval[i++] = ' ';
}
}
else if (*it == '/' && is_next(it, buf.end(), "/*"))
{
@ -1564,6 +1571,12 @@ std::string get_canonical(GWBUF* querybuf)
mxb_assert(it != buf.end());
}
// Remove trailing whitespace
while (i > 0 && is_space(rval[i - 1]))
{
--i;
}
// Shrink the buffer so that the internal bookkeeping of std::string remains up to date
rval.resize(i);