Commit 2c7cb456 authored by Filip Roséen's avatar Filip Roséen Committed by Thomas Guillem

playlist/item: utilize TAB_FIND in ItemIndex

Even though this results in more lines than the previous
implementation, it should be easier to read and reason about the
implementation using the already defined helper for finding entities
within a vlc TAB.
Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent 437fbdce
......@@ -653,9 +653,14 @@ playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
static int ItemIndex ( playlist_item_t *p_item )
{
for( int i = 0; i < p_item->p_parent->i_children; i++ )
if( p_item->p_parent->pp_children[i] == p_item ) return i;
return -1;
int idx;
TAB_FIND( p_item->p_parent->i_children,
p_item->p_parent->pp_children,
p_item,
idx );
return idx;
}
/**
......
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