From 4e845d38132ca0ccf5a46e4a499631657b5b6248 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sun, 12 Oct 2014 15:38:43 +0100 Subject: [PATCH] Directly return when we know the final value --- src/libtomahawk/playlist/PlayableProxyModel.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libtomahawk/playlist/PlayableProxyModel.cpp b/src/libtomahawk/playlist/PlayableProxyModel.cpp index 726694a3f..9320fa3ca 100644 --- a/src/libtomahawk/playlist/PlayableProxyModel.cpp +++ b/src/libtomahawk/playlist/PlayableProxyModel.cpp @@ -263,17 +263,16 @@ PlayableProxyModel::nameFilterAcceptsRow( int sourceRow, PlayableItem* pi, const { QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts ); - bool found = true; foreach( const QString& s, sl ) { if ( !al->name().contains( s, Qt::CaseInsensitive ) && !al->artist()->name().contains( s, Qt::CaseInsensitive ) ) { - found = false; + return false; } } - return found; + return true; } const Tomahawk::artist_ptr& ar = pi->artist(); @@ -281,16 +280,15 @@ PlayableProxyModel::nameFilterAcceptsRow( int sourceRow, PlayableItem* pi, const { QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts ); - bool found = true; foreach( const QString& s, sl ) { if ( !ar->name().contains( s, Qt::CaseInsensitive ) ) { - found = false; + return false; } } - return found; + return true; } return true;