summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2013-09-02 20:28:21 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2014-07-08 15:16:16 (GMT)
commit9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e (patch)
treec463c2d734fc0cb8dbcf62de618692f4fdb6f184 /Source/cmSystemTools.cxx
parent49c830d597bbd8322c7b41847eac3012064b0b7d (diff)
downloadCMake-9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e.zip
CMake-9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e.tar.gz
CMake-9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e.tar.bz2
IsOff: Use the length for the string construction
No need to waste the calculation and force the string to call strlen again.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 12a63b0..aa39c39 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -406,11 +406,12 @@ bool cmSystemTools::IsNOTFOUND(const char* val)
bool cmSystemTools::IsOff(const char* val)
{
- if (!val || strlen(val) == 0)
+ if (!val || !*val)
{
return true;
}
- std::basic_string<char> v = val;
+ size_t len = val ? strlen(val) : 0;
+ std::basic_string<char> v(val, len);
for(std::basic_string<char>::iterator c = v.begin();
c != v.end(); c++)