From dddbad259c5d497987cbb367ce184f3953f2f137 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Mon, 23 Jul 2007 09:06:48 -0400 Subject: PERF: micro optimization: the (*pos1) && (*pos1=='/') were redundant, and hasDoubleSlash is false in most cases, so in most cases 3 comparisons were done, now only one Alex --- Source/cmLocalGenerator.cxx | 8 +++----- Source/kwsys/SystemTools.cxx | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9d2ef54..bcf89e1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2193,13 +2193,12 @@ std::string cmLocalGenerator::Convert(const char* source, break; } } - // Now convert it to an output path. if (output == MAKEFILE) { result = cmSystemTools::ConvertToOutputPath(result.c_str()); } - if( output == SHELL) + else if( output == SHELL) { // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to @@ -2298,9 +2297,8 @@ static bool cmLocalGeneratorNotAbove(const char* a, const char* b) //---------------------------------------------------------------------------- std::string -cmLocalGenerator -::ConvertToRelativePath(const std::vector& local, - const char* in_remote) +cmLocalGenerator::ConvertToRelativePath(const std::vector& local, + const char* in_remote) { // The path should never be quoted. assert(in_remote[0] != '\"'); diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 959f6fc..9476764 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1344,8 +1344,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) } // Also, reuse the loop to check for slash followed by another slash - if ( !hasDoubleSlash && *pos1 && - *pos1 == '/' && *(pos1+1) == '/' ) + if (*pos1 == '/' && *(pos1+1) == '/' && !hasDoubleSlash) { #ifdef _WIN32 // However, on windows if the first characters are both slashes, -- cgit v0.12