avoid some unnecessary copies (#4589)
This commit is contained in:
parent
0ed98c8f29
commit
dc5c5de10e
|
@ -126,8 +126,7 @@ void strTolower(std::string& str)
|
||||||
{
|
{
|
||||||
// This wrapper exists because Sun's CC does not allow a static_cast
|
// This wrapper exists because Sun's CC does not allow a static_cast
|
||||||
// from extern "C" int(*)(int) to int(*)(int).
|
// from extern "C" int(*)(int) to int(*)(int).
|
||||||
static auto tolowerWrapper = [](int c) {
|
std::transform(str.begin(), str.end(), str.begin(), [](int c) {
|
||||||
return std::tolower(c);
|
return std::tolower(c);
|
||||||
};
|
});
|
||||||
std::transform(str.begin(), str.end(), str.begin(), tolowerWrapper);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3840,8 +3840,8 @@ static void valueFlowForwardLifetime(Token * tok, TokenList *tokenlist, ErrorLog
|
||||||
std::list<ValueFlow::Value> values = tok->values();
|
std::list<ValueFlow::Value> values = tok->values();
|
||||||
// Only forward lifetime values
|
// Only forward lifetime values
|
||||||
values.remove_if(&isNotLifetimeValue);
|
values.remove_if(&isNotLifetimeValue);
|
||||||
for (const ValueFlow::Value& value:values)
|
for (ValueFlow::Value& value:values)
|
||||||
setTokenValue(parent, value, tokenlist->getSettings());
|
setTokenValue(parent, std::move(value), tokenlist->getSettings());
|
||||||
valueFlowForwardLifetime(parent, tokenlist, errorLogger, settings);
|
valueFlowForwardLifetime(parent, tokenlist, errorLogger, settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue