Parcourir la source

Merge pull request #1442 from lioncash/format

text_formatter: Avoid unnecessary string temporary creation in PrintMessage()
bunnei il y a 7 ans
Parent
commit
fe292573de
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/common/logging/text_formatter.cpp

+ 1 - 1
src/common/logging/text_formatter.cpp

@@ -31,7 +31,7 @@ std::string FormatLogMessage(const Entry& entry) {
 }
 
 void PrintMessage(const Entry& entry) {
-    auto str = FormatLogMessage(entry) + '\n';
+    const auto str = FormatLogMessage(entry).append(1, '\n');
     fputs(str.c_str(), stderr);
 }