IsOff: Use the length for the string construction

No need to waste the calculation and force the string to call strlen
again.
This commit is contained in:
Ben Boeckel 2013-09-02 16:28:21 -04:00
parent 49c830d597
commit 9270aa9a2d
1 changed files with 3 additions and 2 deletions

View File

@ -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++)