1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

cmCursesLongMessageForm: avoid unnecessary string allocation

The addition makes a temporary string and then drops it after adding it
to `this->Messages`. Instead, just incrementally append.
This commit is contained in:
Ben Boeckel
2020-04-09 11:04:45 -04:00
parent 9532929216
commit 603a532b58

View File

@@ -41,7 +41,8 @@ void cmCursesLongMessageForm::UpdateContent(std::string const& output,
this->Title = title;
if (!output.empty() && this->Messages.size() < MAX_CONTENT_SIZE) {
this->Messages.append("\n" + output);
this->Messages.push_back('\n');
this->Messages.append(output);
form_driver(this->Form, REQ_NEW_LINE);
this->DrawMessage(output.c_str());
}