Explorar el Código

speedup: Cache strings for comparisons

Ben Boeckel hace 11 años
padre
commit
caaad35759
Se han modificado 2 ficheros con 4 adiciones y 2 borrados
  1. 2 1
      Source/cmExtraCodeBlocksGenerator.cxx
  2. 2 1
      Source/cmExtraCodeLiteGenerator.cxx

+ 2 - 1
Source/cmExtraCodeBlocksGenerator.cxx

@@ -414,12 +414,13 @@ void cmExtraCodeBlocksGenerator
             std::string lang = (*si)->GetLanguage();
             if (lang == "C" || lang == "CXX")
               {
+              std::string srcext = (*si)->GetExtension();
               for(std::vector<std::string>::const_iterator
                   ext = mf->GetSourceExtensions().begin();
                   ext !=  mf->GetSourceExtensions().end();
                   ++ext)
                 {
-                if ((*si)->GetExtension() == *ext)
+                if (srcext == *ext)
                   {
                   isCFile = true;
                   break;

+ 2 - 1
Source/cmExtraCodeLiteGenerator.cxx

@@ -223,12 +223,13 @@ void cmExtraCodeLiteGenerator
             std::string lang = (*si)->GetLanguage();
             if (lang == "C" || lang == "CXX")
               {
+              std::string srcext = (*si)->GetExtension();
               for(std::vector<std::string>::const_iterator
                   ext = mf->GetSourceExtensions().begin();
                   ext !=  mf->GetSourceExtensions().end();
                   ++ext)
                 {
-                if ((*si)->GetExtension() == *ext)
+                if (srcext == *ext)
                   {
                   isCFile = true;
                   break;