mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-30 02:59:22 -05:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user