unquote takes s by reference.

Closes #471.
This commit is contained in:
Klemens Morgenstern
2022-10-12 02:00:25 +08:00
committed by Klemens Morgenstern
parent 8f74e0d464
commit 1a02413638
2 changed files with 6 additions and 8 deletions

View File

@@ -88,8 +88,8 @@ private:
BOOST_BEAST_DECL
static
std::string
unquote(string_view sr);
void
unquote(string_view sr, std::string & s);
BOOST_BEAST_DECL
void

View File

@@ -18,11 +18,10 @@ namespace beast {
namespace http {
std::string
param_list::const_iterator::
unquote(string_view sr)
void param_list::const_iterator::
unquote(string_view sr, std::string &s)
{
std::string s;
s.clear();
s.reserve(sr.size());
auto it = sr.begin() + 1;
auto end = sr.end() - 1;
@@ -33,7 +32,6 @@ unquote(string_view sr)
s.push_back(*it);
++it;
}
return s;
}
void
@@ -50,7 +48,7 @@ increment()
else if(! pi_.v.second.empty() &&
pi_.v.second.front() == '"')
{
s_ = unquote(pi_.v.second);
unquote(pi_.v.second, s_);
pi_.v.second = string_view{
s_.data(), s_.size()};
}