Bladeren bron

Move loop inside of condition.

The loop is only executed if the condition is true.
Stephen Kelly 10 jaren geleden
bovenliggende
commit
abfca97525
1 gewijzigde bestanden met toevoegingen van 12 en 12 verwijderingen
  1. 12 12
      Source/cmLocalUnixMakefileGenerator3.cxx

+ 12 - 12
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.size() > 1)
       {
-      if(!components[i].empty())
+      // 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(!first)
+        if(!components[i].empty())
           {
-          result += slash;
+          if(!first)
+            {
+            result += slash;
+            }
+          result += components[i];
+          first = false;
           }
-        result += components[i];
-        first = false;
         }
-      }
-    if (components.size() > 1)
-      {
       // Only the last component can be empty to avoid double slashes.
       if(!first)
         {