From abfca97525be06e067981b6c6bf63ba7a3aa52f9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 10 Feb 2015 23:09:03 +0100 Subject: [PATCH] Move loop inside of condition. The loop is only executed if the condition is true. --- Source/cmLocalUnixMakefileGenerator3.cxx | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 32da82180..703ab2724 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -2295,23 +2295,23 @@ cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p, // Begin the quoted result with the root component. result += components[0]; - // Now add the rest of the components separated by the proper slash - // direction for this platform. - bool first = true; - for(unsigned int i=1; i < components.size() - 1; ++i) - { - if(!components[i].empty()) - { - if(!first) - { - result += slash; - } - result += components[i]; - first = false; - } - } if (components.size() > 1) { + // Now add the rest of the components separated by the proper slash + // direction for this platform. + bool first = true; + for(unsigned int i=1; i < components.size() - 1; ++i) + { + if(!components[i].empty()) + { + if(!first) + { + result += slash; + } + result += components[i]; + first = false; + } + } // Only the last component can be empty to avoid double slashes. if(!first) {