From 603a532b5899d4bbb1ae375c26cfa5a95c95416d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 9 Apr 2020 11:04:45 -0400 Subject: 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. --- Source/CursesDialog/cmCursesLongMessageForm.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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()); } -- cgit v0.12