diff options
| author | 2018-10-04 23:55:50 -0400 | |
|---|---|---|
| committer | 2018-10-04 23:55:53 -0400 | |
| commit | 6f168262605d7979d8069cd9dad21932a522263d (patch) | |
| tree | 79f732b0a01deca032c6d1cf6ab408c454c08037 | |
| parent | Merge pull request #1330 from raven02/tlds (diff) | |
| download | yuzu-6f168262605d7979d8069cd9dad21932a522263d.tar.gz yuzu-6f168262605d7979d8069cd9dad21932a522263d.tar.xz yuzu-6f168262605d7979d8069cd9dad21932a522263d.zip | |
text_formatter: Avoid unnecessary string temporary creation in PrintMessage()
operator+ for std::string creates an entirely new string, which is kind
of unnecessary here if we just want to append a null terminator to the
existing one.
Reduces the total amount of potential allocations that need to be done
in the logging path.
Diffstat (limited to '')
| -rw-r--r-- | src/common/logging/text_formatter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp index 05437c137..6a0605c63 100644 --- a/src/common/logging/text_formatter.cpp +++ b/src/common/logging/text_formatter.cpp | |||
| @@ -31,7 +31,7 @@ std::string FormatLogMessage(const Entry& entry) { | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | void PrintMessage(const Entry& entry) { | 33 | void PrintMessage(const Entry& entry) { |
| 34 | auto str = FormatLogMessage(entry) + '\n'; | 34 | const auto str = FormatLogMessage(entry).append(1, '\n'); |
| 35 | fputs(str.c_str(), stderr); | 35 | fputs(str.c_str(), stderr); |
| 36 | } | 36 | } |
| 37 | 37 | ||