diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2013-09-02 20:28:21 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2014-07-08 15:16:16 (GMT) |
commit | 9270aa9a2d1ea05e7bd63ef5214f4fbaafd14d2e (patch) | |
tree | c463c2d734fc0cb8dbcf62de618692f4fdb6f184 /Source/cmSystemTools.cxx | |
parent | 49c830d597bbd8322c7b41847eac3012064b0b7d (diff) | |
download | CMake-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.cxx | 5 |
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++) |