diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-05-21 15:52:07 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-05-21 15:52:07 (GMT) |
commit | f49e76899cbe9df732c7ef319eaa87f47235fed9 (patch) | |
tree | 57893fce6bfe1a780765112b6527e1bc711e1686 | |
parent | d655b65256126e3e64156a5fc94c384925eed0ec (diff) | |
download | CMake-f49e76899cbe9df732c7ef319eaa87f47235fed9.zip CMake-f49e76899cbe9df732c7ef319eaa87f47235fed9.tar.gz CMake-f49e76899cbe9df732c7ef319eaa87f47235fed9.tar.bz2 |
ENH: speed up for NOTFOUND
-rw-r--r-- | Source/cmSystemTools.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index a6872f1..7ddb878 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; + } + if(len == lenNotFound-1) + { + return ( strcmp(val, "NOTFOUND") == 0); } - return std::string("NOTFOUND") == val; + return ((strncmp((val + (len - lenNotFound)), notfound, lenNotFound) == 0)); } |