summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-04-09 15:04:45 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2020-04-09 15:04:45 (GMT)
commit603a532b5899d4bbb1ae375c26cfa5a95c95416d (patch)
treec5db9d87a9f7cfdc85a7c783527848b3742832c8 /Source
parent953292921652377ae03bf7413ed115e03c7bd83b (diff)
downloadCMake-603a532b5899d4bbb1ae375c26cfa5a95c95416d.zip
CMake-603a532b5899d4bbb1ae375c26cfa5a95c95416d.tar.gz
CMake-603a532b5899d4bbb1ae375c26cfa5a95c95416d.tar.bz2
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.
Diffstat (limited to 'Source')
-rw-r--r--Source/CursesDialog/cmCursesLongMessageForm.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index afd2b6b..664ba2f 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -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());
}