Skip to content
Permalink
Browse files

Don't use .lower() to perform case-insensitive string operations

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 ce4ac074cd40e328953dc6f6c7793786f05eb27f
Showing with 5 additions and 5 deletions.
  1. +1 −1 src/core/processing/qgsprocessingparameters.cpp
  2. +4 −4 src/core/qgsstacktrace.cpp
@@ -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
@@ -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.
You can’t perform that action at this time.