Use char literal instead of string literal with 1 char

In reality, this is a relatively small performance improvement,
especially with the previous improvements removing lots of superfluous
string handling, but still was measurable.
This commit is contained in:
Martin Hořeňovský
2017-01-29 23:07:15 +01:00
parent efab3ca8b2
commit bcaa2f9646
13 changed files with 72 additions and 72 deletions

View File

@@ -136,7 +136,7 @@ namespace Catch {
XmlWriter& startElement( std::string const& name ) {
ensureTagClosed();
newlineIfNecessary();
stream() << m_indent << "<" << name;
stream() << m_indent << '<' << name;
m_tags.push_back( name );
m_indent += " ";
m_tagIsOpen = true;
@@ -165,12 +165,12 @@ namespace Catch {
XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ) {
if( !name.empty() && !attribute.empty() )
stream() << " " << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << "\"";
stream() << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
return *this;
}
XmlWriter& writeAttribute( std::string const& name, bool attribute ) {
stream() << " " << name << "=\"" << ( attribute ? "true" : "false" ) << "\"";
stream() << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"';
return *this;
}
@@ -227,7 +227,7 @@ namespace Catch {
void newlineIfNecessary() {
if( m_needsNewline ) {
stream() << "\n";
stream() << '\n';
m_needsNewline = false;
}
}