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:
parent
49c830d597
commit
9270aa9a2d
|
@ -406,11 +406,12 @@ bool cmSystemTools::IsNOTFOUND(const char* val)
|
||||||
|
|
||||||
bool cmSystemTools::IsOff(const char* val)
|
bool cmSystemTools::IsOff(const char* val)
|
||||||
{
|
{
|
||||||
if (!val || strlen(val) == 0)
|
if (!val || !*val)
|
||||||
{
|
{
|
||||||
return true;
|
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();
|
for(std::basic_string<char>::iterator c = v.begin();
|
||||||
c != v.end(); c++)
|
c != v.end(); c++)
|
||||||
|
|
Loading…
Reference in New Issue