Optimize calls to find*() for a single char.

The character literal overload is more efficient.
This commit is contained in:
Vaclav Brozek 2021-03-02 18:59:31 +01:00
parent abea1a8484
commit 364e98c92d
2 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ std::string base64_decode(std::string const& encoded_string, bool remove_linebre
std::string copy(encoded_string);
size_t pos=0;
while ((pos = copy.find("\n", pos)) != std::string::npos) {
while ((pos = copy.find('\n', pos)) != std::string::npos) {
copy.erase(pos, 1);
}

View File

@ -149,7 +149,7 @@ Vec3f Model::vert(int iface, int nthvert)
void Model::load_texture(std::string filename, const char *suffix, TGAImage &img)
{
std::string texfile(filename);
size_t dot = texfile.find_last_of(".");
size_t dot = texfile.find_last_of('.');
if (dot != std::string::npos)
{
texfile = texfile.substr(0, dot) + std::string(suffix);