Use StringRef through XmlEncode

This introduces a potential lifetime risk when using the API, but
the intended way to use the `XmlEncode` class is to use it directly,
e.g. `out << XmlEncode(some-text-argument)`, not to store it around.

The benefit is that we avoid allocations for strings that do not fit
into SSO for given platform.
This commit is contained in:
Martin Hořeňovský
2021-05-29 16:41:57 +02:00
parent aba114d6fe
commit 1d04427fcd
2 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ namespace {
}
XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat )
XmlEncode::XmlEncode( StringRef str, ForWhat forWhat )
: m_str( str ),
m_forWhat( forWhat )
{}