mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -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:
@@ -2,7 +2,7 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmCTestMemCheckCommand.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "cmCTest.h"
|
||||
@@ -44,8 +44,9 @@ void cmCTestMemCheckCommand::ProcessAdditionalValues(
|
||||
cmCTestGenericHandler* handler)
|
||||
{
|
||||
if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) {
|
||||
std::ostringstream str;
|
||||
str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount();
|
||||
this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT], str.str());
|
||||
this->Makefile->AddDefinition(
|
||||
this->Values[ctm_DEFECT_COUNT],
|
||||
std::to_string(
|
||||
static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user