Commit d45cd9a3 authored by Marco Bubke's avatar Marco Bubke

Utils: Use C string functions

They are better optimized.

Change-Id: I6db1c94d283ee9f3f1555ce02b9b42d38003e2d0
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
parent d6d761d8
......@@ -367,19 +367,17 @@ public:
return BasicSmallString(utf8ByteArray.constData(), uint(utf8ByteArray.size()));
}
// precondition: has to be null terminated
bool contains(SmallStringView subStringToSearch) const
{
auto found = std::search(begin(),
end(),
subStringToSearch.begin(),
subStringToSearch.end());
const char *found = std::strstr(data(), subStringToSearch.data());
return found != end();
return found != nullptr;
}
bool contains(char characterToSearch) const
{
auto found = std::strchr(data(), characterToSearch);
auto found = std::memchr(data(), characterToSearch, size());
return found != nullptr;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment