Commit 538a9b4d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_object_find_name: simplify FIND_ANYWHERE

parent 5d600458
......@@ -526,31 +526,15 @@ vlc_object_t *vlc_object_find_name( vlc_object_t *p_this,
return p_this;
}
libvlc_lock (p_this->p_libvlc);
/* Otherwise, recursively look for the object */
if( i_mode == FIND_ANYWHERE )
{
vlc_object_t *p_root = p_this;
if (i_mode == FIND_ANYWHERE)
return vlc_object_find_name (VLC_OBJECT(p_this->p_libvlc), psz_name,
FIND_CHILD);
/* Find the root */
while( p_root->p_parent != NULL &&
p_root != VLC_OBJECT( p_this->p_libvlc ) )
{
p_root = p_root->p_parent;
}
libvlc_lock (p_this->p_libvlc);
p_found = FindObjectName( p_root, psz_name, FIND_CHILD );
if( p_found == NULL && p_root != VLC_OBJECT( p_this->p_libvlc ) )
{
p_found = FindObjectName( VLC_OBJECT( p_this->p_libvlc ),
psz_name, FIND_CHILD );
}
}
else
{
p_found = FindObjectName( p_this, psz_name, i_mode );
}
/* Otherwise, recursively look for the object */
p_found = FindObjectName( p_this, psz_name, i_mode );
libvlc_unlock (p_this->p_libvlc);
return p_found;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment