mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Use std::string_view to avoid redundant std::string construction
This commit is contained in:
parent
caf971b979
commit
ba69146ced
4 changed files with 10 additions and 9 deletions
|
@ -36,8 +36,8 @@ namespace Interpreter{
|
|||
if(eschar == '%' || eschar == '^')
|
||||
{
|
||||
retval << text.substr(start, i - start);
|
||||
std::string temp = Misc::StringUtils::lowerCase(text.substr(i+1, 100));
|
||||
|
||||
std::string temp = Misc::StringUtils::lowerCase(std::string_view(text).substr(i + 1, 100));
|
||||
|
||||
bool found = false;
|
||||
try
|
||||
{
|
||||
|
@ -170,10 +170,10 @@ namespace Interpreter{
|
|||
sort(globals.begin(), globals.end(), longerStr);
|
||||
}
|
||||
|
||||
for(unsigned int j = 0; j < globals.size(); j++){
|
||||
if(globals[j].length() > temp.length()){ // Just in case there's a global with a huuuge name
|
||||
temp = Misc::StringUtils::lowerCase(text.substr(i+1, globals[j].length()));
|
||||
}
|
||||
for(unsigned int j = 0; j < globals.size(); j++)
|
||||
{
|
||||
if (globals[j].length() > temp.length()) // Just in case there's a global with a huuuge name
|
||||
temp = Misc::StringUtils::lowerCase(std::string_view(text).substr(i + 1, globals[j].length()));
|
||||
|
||||
found = check(temp, globals[j], &i, &start);
|
||||
if(found){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue