[vlc-devel] commit: Simplify vlc_object_find(FIND_ANYWHERE) ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue May 27 17:41:13 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Tue May 27 18:42:48 2008 +0300| [14be786c1f5cb85549cba8cc125e57bb40eda4c6]

Simplify vlc_object_find(FIND_ANYWHERE)

We end up looking up from p_libvlc anyway, so we might as well as well
do it from the beginning

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

 src/misc/objects.c |   21 ++-------------------
 1 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/src/misc/objects.c b/src/misc/objects.c
index 8092c39..452f52d 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -714,27 +714,10 @@ void * __vlc_object_find( vlc_object_t *p_this, int i_type, int i_mode )
 
     /* Otherwise, recursively look for the object */
     if( (i_mode & 0x000f) == FIND_ANYWHERE )
-    {
-        vlc_object_t *p_root = p_this;
-
-        /* Find the root */
-        while( p_root->p_parent != NULL &&
-               p_root != VLC_OBJECT( p_this->p_libvlc ) )
-        {
-            p_root = p_root->p_parent;
-        }
-
-        p_found = FindObject( p_root, i_type, (i_mode & ~0x000f)|FIND_CHILD );
-        if( p_found == NULL && p_root != VLC_OBJECT( p_this->p_libvlc ) )
-        {
-            p_found = FindObject( VLC_OBJECT( p_this->p_libvlc ),
-                                  i_type, (i_mode & ~0x000f)|FIND_CHILD );
-        }
-    }
+        p_found = FindObject( p_this->p_libvlc, i_type,
+                              (i_mode & ~0x000f)|FIND_CHILD );
     else
-    {
         p_found = FindObject( p_this, i_type, i_mode );
-    }
 
     vlc_mutex_unlock( &structure_lock );
 




More information about the vlc-devel mailing list