Use the more efficient character literal overload for find_first_of/find_last_of

Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html
This commit is contained in:
scribam 2019-06-01 15:03:08 +02:00 committed by Ivan
parent 78c7ef3039
commit bf557ea6e6
3 changed files with 4 additions and 4 deletions

View file

@ -45,7 +45,7 @@ error_code sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadle
std::string& input = g_tty_input[ch].front();
// we have to stop reading at either a new line, the param len, or our input string size
size_t new_line_pos = input.find_first_of("\n");
size_t new_line_pos = input.find_first_of('\n');
if (new_line_pos != input.npos)
{

View file

@ -190,7 +190,7 @@ public:
simple_var = var;
}
const auto brace_pos = var.find_last_of(")");
const auto brace_pos = var.find_last_of(')');
std::string prefix;
if (brace_pos != std::string::npos)
{

View file

@ -186,12 +186,12 @@ gs_frame::gs_frame(const QString& title, const QRect& geometry, const QIcon& app
//Get version by substringing VersionNumber-buildnumber-commithash to get just the part before the dash
std::string version = rpcs3::version.to_string();
version = version.substr(0 , version.find_last_of("-"));
version = version.substr(0 , version.find_last_of('-'));
//Add branch and commit hash to version on frame , unless it's master.
if ((rpcs3::get_branch().compare("master") != 0) && (rpcs3::get_branch().compare("HEAD") != 0))
{
version = version + "-" + rpcs3::version.to_string().substr((rpcs3::version.to_string().find_last_of("-") + 1), 8) + "-" + rpcs3::get_branch();
version = version + "-" + rpcs3::version.to_string().substr((rpcs3::version.to_string().find_last_of('-') + 1), 8) + "-" + rpcs3::get_branch();
}
m_windowTitle += qstr(" | " + version);