From 4630d8e25a64fb748c05ecb78375a9f2057c0923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Wed, 16 Nov 2016 22:19:52 +0200 Subject: [PATCH] playlist: inline playlist_NodeEmpty() --- src/playlist/item.c | 7 ++++++- src/playlist/playlist_internal.h | 2 -- src/playlist/tree.c | 20 -------------------- 3 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/playlist/item.c b/src/playlist/item.c index ba49d6f44b..9a11e6c85b 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 04a4f3c563..96bd8ad40a 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 88e99bbe41..ad41bd2c75 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 * -- GitLab