From f49e76899cbe9df732c7ef319eaa87f47235fed9 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 21 May 2004 11:52:07 -0400 Subject: [PATCH] ENH: speed up for NOTFOUND --- Source/cmSystemTools.cxx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a6872f168..7ddb878c2 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -304,12 +304,18 @@ 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-1) { - return true; + return false; } - return std::string("NOTFOUND") == val; + if(len == lenNotFound-1) + { + return ( strcmp(val, "NOTFOUND") == 0); + } + return ((strncmp((val + (len - lenNotFound)), notfound, lenNotFound) == 0)); }