Commit 3f81cf7e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

playlist: inline playlist_NodeRemoveItem()

parent f2931531
......@@ -363,7 +363,6 @@ VLC_API int playlist_LiveSearchUpdate(playlist_t *, playlist_item_t *, const cha
VLC_API playlist_item_t * playlist_NodeCreate( playlist_t *, const char *, playlist_item_t * p_parent, int i_pos, int i_flags, input_item_t * );
VLC_API int playlist_NodeAppend(playlist_t *,playlist_item_t*,playlist_item_t *);
VLC_API int playlist_NodeInsert(playlist_t *,playlist_item_t*,playlist_item_t *, int);
VLC_API int playlist_NodeRemoveItem(playlist_t *,playlist_item_t*,playlist_item_t *);
VLC_API playlist_item_t * playlist_ChildSearchName(playlist_item_t*, const char* ) VLC_USED;
VLC_API void playlist_NodeDelete( playlist_t *, playlist_item_t *, bool , bool );
......
......@@ -357,7 +357,6 @@ playlist_NodeAppend
playlist_NodeCreate
playlist_NodeDelete
playlist_NodeInsert
playlist_NodeRemoveItem
playlist_RecursiveNodeSort
playlist_ServicesDiscoveryAdd
playlist_ServicesDiscoveryControl
......
......@@ -178,8 +178,18 @@ void playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
PL_DEBUG( "deleting item `%s'", p_root->p_input->psz_name );
/* Remove the item from its parent */
if( p_root->p_parent )
playlist_NodeRemoveItem( p_playlist, p_root, p_root->p_parent );
playlist_item_t *p_parent = p_root->p_parent;
if( p_parent != NULL )
{
for( int i = 0; i < p_parent->i_children ; i++ )
{
if( p_parent->pp_children[i] == p_root )
{
REMOVE_ELEM( p_parent->pp_children, p_parent->i_children, i );
assert( p_root->p_parent == p_parent );
}
}
}
playlist_ItemRelease( p_root );
}
......@@ -224,40 +234,6 @@ int playlist_NodeInsert( playlist_t *p_playlist,
return VLC_SUCCESS;
}
/**
* Deletes an item from the children of a node
*
* \param p_playlist the playlist
* \param p_item the item to remove
* \param p_parent the parent node
* \return VLC_SUCCESS or an error
*/
int playlist_NodeRemoveItem( playlist_t *p_playlist,
playlist_item_t *p_item,
playlist_item_t *p_parent )
{
PL_ASSERT_LOCKED;
(void)p_playlist;
int ret = VLC_EGENERIC;
for(int i= 0; i< p_parent->i_children ; i++ )
{
if( p_parent->pp_children[i] == p_item )
{
REMOVE_ELEM( p_parent->pp_children, p_parent->i_children, i );
ret = VLC_SUCCESS;
}
}
if( ret == VLC_SUCCESS ) {
assert( p_item->p_parent == p_parent );
p_item->p_parent = NULL;
}
return ret;
}
/**
* Search a child of a node by its name
*
......
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