From 342d69a43043fe4f6fcc8adb6a155405ee279efb Mon Sep 17 00:00:00 2001 From: Ben Boeckel <ben.boeckel@kitware.com> Date: Tue, 23 Jan 2018 18:39:26 -0500 Subject: [PATCH] ConvertToUnixSlashes: short-circuit on hasDoubleSlash Checking the bool is faster than checking characters, so perform it first. --- SystemTools.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index f7e39e38..9c64d117 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -1897,7 +1897,7 @@ void SystemTools::ConvertToUnixSlashes(std::string& path) } // Also, reuse the loop to check for slash followed by another slash - if (*pos1 == '/' && *(pos1 + 1) == '/' && !hasDoubleSlash) { + if (!hasDoubleSlash && *pos1 == '/' && *(pos1 + 1) == '/') { #ifdef _WIN32 // However, on windows if the first characters are both slashes, // then keep them that way, so that network paths can be handled. -- GitLab