From 470cff497bc26d48ee05de0b260af2546bb7698c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 27 Jan 2015 22:39:46 +0100 Subject: [PATCH] cmMakefile: Replace loop with composed algorithm. --- Source/cmMakefile.cxx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index ac5fec9c3..2085a973e 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1472,18 +1472,11 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove) cmSystemTools::ExpandListArgument(cdefs, defs); // Recompose the list without the definition. - std::string ndefs; - const char* sep = ""; - for(std::vector::const_iterator di = defs.begin(); - di != defs.end(); ++di) - { - if(*di != define) - { - ndefs += sep; - sep = ";"; - ndefs += *di; - } - } + std::vector::const_iterator defEnd = + std::remove(defs.begin(), defs.end(), define); + std::vector::const_iterator defBegin = + defs.begin(); + std::string ndefs = cmJoin(cmRange(defBegin, defEnd), ";"); // Store the new list. this->SetProperty("COMPILE_DEFINITIONS", ndefs.c_str());