diff --git a/src/playlist/item.c b/src/playlist/item.c index ba49d6f44b517b5973b58997db692cf80052ba4c..9a11e6c85b9286c8f868e39e175ad7a21a84ba3f 100644 --- a/src/playlist/item.c +++ b/src/playlist/item.c @@ -352,8 +352,13 @@ int playlist_DeleteFromInput( playlist_t *p_playlist, input_item_t *p_input, */ void playlist_Clear( playlist_t * p_playlist, bool b_locked ) { + playlist_item_t *p_root = p_playlist->p_playing; + PL_LOCK_IF( !b_locked ); - playlist_NodeEmpty( p_playlist, p_playlist->p_playing ); + + for( int i = p_root->i_children - 1; i >= 0 ;i-- ) + playlist_NodeDelete( p_playlist, p_root->pp_children[i], false ); + PL_UNLOCK_IF( !b_locked ); } diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h index 04a4f3c56392d5955c0a3fa469c1b4afb503ef64..96bd8ad40af19f4bcfc7704fd195a98f85b99e09 100644 --- a/src/playlist/playlist_internal.h +++ b/src/playlist/playlist_internal.h @@ -134,8 +134,6 @@ playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist, void playlist_ItemRelease( playlist_item_t * ); -void playlist_NodeEmpty( playlist_t *, playlist_item_t * ); - void ResetCurrentlyPlaying( playlist_t *p_playlist, playlist_item_t *p_cur ); void ResyncCurrentIndex( playlist_t *p_playlist, playlist_item_t *p_cur ); diff --git a/src/playlist/tree.c b/src/playlist/tree.c index 88e99bbe418c883de4dc7745527912bd728f75bf..ad41bd2c75e22d21461edaf0db7aee691dc4abac 100644 --- a/src/playlist/tree.c +++ b/src/playlist/tree.c @@ -86,26 +86,6 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, return p_item; } -/** - * Remove all the children of a node - * - * This function must be entered with the playlist lock - * - * \param p_playlist the playlist - * \param p_root the node - */ -void playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root ) -{ - PL_ASSERT_LOCKED; - - if( p_root->i_children == -1 ) - return; - - /* Delete the children */ - for( int i = p_root->i_children-1 ; i >= 0 ;i-- ) - playlist_NodeDelete( p_playlist, p_root->pp_children[i], false ); -} - /** * Remove all the children of a node and removes the node *