[patch] unused value

Erik Hovland erik at hovland.org
Fri Dec 1 20:16:13 UTC 2006


In src/filebrowser.cpp there is an instance where the search for a
current folder is superflous. This patch moves the pointer declaration
to the only scope it is necessary and removes a superflous call in
another scope.

This patch also addresses an issue where the call to begin() is done
twice. It really isn't necessary the first time so the declare and the
call are moved into the for().

E

-- 
Erik Hovland
mail: erik AT hovland DOT org
web: http://hovland.org/
PGP/GPG public key available on request
-------------- next part --------------
This patch collects unused values

Signed-off-by: Erik Hovland <erik at hovland.org>


---

 src/contextbrowser.cpp |    3 +--
 src/filebrowser.cpp    |    4 +---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/contextbrowser.cpp b/src/contextbrowser.cpp
index c177169..c24f1c2 100644
--- a/src/contextbrowser.cpp
+++ b/src/contextbrowser.cpp
@@ -1636,8 +1636,7 @@ void CurrentTrackJob::showLastFm( const
     newUrls.append( &artistUrl );
     newUrls.append( &titleUrl  );
 
-    QString* url = newUrls.first();
-    for ( url = newUrls.first(); url; url = newUrls.next() )
+    for ( QString* url = newUrls.first(); url; url = newUrls.next() )
         url->replace( QRegExp( "^http:" ), "externalurl:" );
 
     const QString skipIcon = KGlobal::iconLoader()->iconPath( Amarok::icon("next"),   -KIcon::SizeSmallMedium );
diff --git a/src/filebrowser.cpp b/src/filebrowser.cpp
index 140bead..c4e6b82 100644
--- a/src/filebrowser.cpp
+++ b/src/filebrowser.cpp
@@ -72,14 +72,13 @@ FileBrowser::FileBrowser( const char * n
     SearchPane *searchPane;
 
     KURL *location;
-    KFileItem *currentFolder;
 
     // Try to keep filebrowser working even if not in a medium context
     // so if a medium object not passed in, keep earlier behavior
     if (!medium) {
         m_medium = 0;
         location = new KURL( Amarok::config( "Filebrowser" )->readPathEntry( "Location", QDir::homeDirPath() ) );
-        currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location );
+        KFileItem *currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location );
         //KIO sucks, NetAccess::exists puts up a dialog and has annoying error message boxes
         //if there is a problem so there is no point in using it anyways.
         //so... setting the diroperator to ~ is the least sucky option
@@ -91,7 +90,6 @@ FileBrowser::FileBrowser( const char * n
     else{
         m_medium = medium;
         location = new KURL( m_medium->mountPoint() );
-        currentFolder = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, *location );
     }
 
     KActionCollection* ac = new KActionCollection( this );


More information about the Amarok mailing list