Skip to content

Commit

Permalink
vlc_object_find_name: simplify FIND_ANYWHERE
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémi Denis-Courmont committed Jan 23, 2010
1 parent 5d60045 commit 538a9b4
Showing 1 changed file with 6 additions and 22 deletions.
28 changes: 6 additions & 22 deletions src/misc/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 538a9b4

Please sign in to comment.