[vlc-commits] commit: skins2: remove unnecessary lookup (Erwan Tulou )

git at videolan.org git at videolan.org
Sun Jan 16 23:05:50 CET 2011


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Sat Jan 15 22:10:48 2011 +0100| [b630fa63c82e80cfd0420e1c18693d6c2fcc82f3] | committer: Erwan Tulou 

skins2: remove unnecessary lookup

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b630fa63c82e80cfd0420e1c18693d6c2fcc82f3
---

 modules/gui/skins2/vars/playtree.cpp |   26 +++++++++++---------------
 1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/modules/gui/skins2/vars/playtree.cpp b/modules/gui/skins2/vars/playtree.cpp
index cd07143..d0bf1ca 100644
--- a/modules/gui/skins2/vars/playtree.cpp
+++ b/modules/gui/skins2/vars/playtree.cpp
@@ -210,24 +210,20 @@ void Playtree::onAppend( playlist_add_t *p_add )
     Iterator node = findById( p_add->i_node );
     if( node != end() )
     {
-        Iterator item =  findById( p_add->i_item );
-        if( item == end() )
+        playlist_Lock( m_pPlaylist );
+        playlist_item_t *p_item = playlist_ItemGetById(
+                                    m_pPlaylist, p_add->i_item );
+        if( !p_item )
         {
-            playlist_Lock( m_pPlaylist );
-            playlist_item_t *p_item = playlist_ItemGetById(
-                                        m_pPlaylist, p_add->i_item );
-            if( !p_item )
-            {
-                playlist_Unlock( m_pPlaylist );
-                return;
-            }
-            UString *pName = new UString( getIntf(),
-                                          p_item->p_input->psz_name );
-            node->add( p_add->i_item, UStringPtr( pName ),
-                      false,false, false, p_item->i_flags & PLAYLIST_RO_FLAG,
-                      p_item );
             playlist_Unlock( m_pPlaylist );
+            return;
         }
+        UString *pName = new UString( getIntf(),
+                                      p_item->p_input->psz_name );
+        node->add( p_add->i_item, UStringPtr( pName ),
+                  false,false, false, p_item->i_flags & PLAYLIST_RO_FLAG,
+                  p_item );
+        playlist_Unlock( m_pPlaylist );
     }
     tree_update descr;
     descr.i_id = p_add->i_item;



More information about the vlc-commits mailing list