Source sweep: Replace std::ostringstream when used with a single append

This replaces `std::ostringstream`, when it is written to only once.
If the single written argument was numeric, `std::to_string` is used instead.
Otherwise, the single written argument is used directly instead of the
`std::ostringstream::str()` invocation.
This commit is contained in:
Sebastian Holtermann
2019-08-23 12:21:46 +02:00
parent 19612dffd2
commit 3b2b02825d
24 changed files with 92 additions and 153 deletions
+1 -5
View File
@@ -5,8 +5,6 @@
#include "cmCTestScriptHandler.h"
#include "cmMakefile.h"
#include <sstream>
class cmExecutionStatus;
bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
@@ -41,9 +39,7 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector<std::string> const& args,
int ret;
cmCTestScriptHandler::RunScript(this->CTest, this->Makefile,
args[i].c_str(), !np, &ret);
std::ostringstream str;
str << ret;
this->Makefile->AddDefinition(returnVariable, str.str());
this->Makefile->AddDefinition(returnVariable, std::to_string(ret));
}
}
return true;