Skip to content

Commit

Permalink
Don't use .lower() to perform case-insensitive string operations
Browse files Browse the repository at this point in the history
Use the faster versions with Qt::CaseInsensitive instead. These
don't require a string copy and conversion to lowercase.

Thanks to Clazy
  • Loading branch information
nyalldawson committed Aug 29, 2017
1 parent 5197b5f commit ce4ac07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingparameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ bool QgsProcessingParameters::parseScriptCodeParameterOptions( const QString &co

name = m.captured( 1 );
QString tokens = m.captured( 2 );
if ( tokens.toLower().startsWith( QStringLiteral( "optional" ) ) )
if ( tokens.startsWith( QStringLiteral( "optional" ), Qt::CaseInsensitive ) )
{
isOptional = true;
tokens.remove( 0, 8 ); // length "optional" = 8
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgsstacktrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,14 @@ QgsStackTrace::QgsStackTrace()

bool QgsStackTrace::StackLine::isQgisModule() const
{
return moduleName.toLower().contains( "qgis" );
return moduleName.contains( "qgis", Qt::CaseInsensitive );
}

bool QgsStackTrace::StackLine::isValid() const
{
return !( fileName.toLower().contains( "exe_common" ) ||
fileName.toLower().contains( "unknown" ) ||
lineNumber.toLower().contains( "unknown" ) );
return !( fileName.contains( "exe_common", Qt::CaseInsensitive ) ||
fileName.contains( "unknown", Qt::CaseInsensitive ) ||
lineNumber.contains( "unknown", Qt::CaseInsensitive ) );

}
///@endcond

0 comments on commit ce4ac07

Please sign in to comment.