From 66288b115e9adb01933b1092fdd35a513774eb66 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 20 May 2004 17:33:58 -0400 Subject: ENH: remove regex use where strcmp is faster --- Source/cmSystemTools.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a6872f1..b6cd957 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -304,12 +304,22 @@ bool cmSystemTools::IsOn(const char* val) bool cmSystemTools::IsNOTFOUND(const char* val) { - cmsys::RegularExpression reg("-NOTFOUND$"); - if(reg.find(val)) + int len = strlen(val); + const char* notfound = "-NOTFOUND"; + const int lenNotFound = 9; + if(len < lenNotFound) + { + return false; + } + if(strncmp((val + (len - lenNotFound)), notfound, lenNotFound) == 0) { return true; } - return std::string("NOTFOUND") == val; + if(strcmp(val, "NOTFOUND") == 0) + { + return true; + } + return false; } -- cgit v0.12