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

playlist: make item deletion function return void

...where applicable. (Some other functions conditionally delete stuff;
those functions can actually fail.)
parent 2575bf38
......@@ -365,7 +365,7 @@ 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 int playlist_NodeDelete( playlist_t *, playlist_item_t *, bool , bool );
VLC_API void playlist_NodeDelete( playlist_t *, playlist_item_t *, bool , bool );
VLC_API playlist_item_t * playlist_GetNextLeaf( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed ) VLC_USED;
VLC_API playlist_item_t * playlist_GetPrevLeaf( playlist_t *p_playlist, playlist_item_t *p_root, playlist_item_t *p_item, bool b_ena, bool b_unplayed ) VLC_USED;
......
......@@ -300,9 +300,8 @@ playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
* Release an item
*
* \param p_item item to delete
* \return VLC_SUCCESS
*/
int playlist_ItemRelease( playlist_item_t *p_item )
void playlist_ItemRelease( playlist_item_t *p_item )
{
/* For the assert */
playlist_t *p_playlist = p_item->p_playlist;
......@@ -312,7 +311,6 @@ int playlist_ItemRelease( playlist_item_t *p_item )
free( p_item->pp_children );
vlc_gc_decref( p_item->p_input );
free( p_item );
return VLC_SUCCESS;
}
/**
......@@ -331,7 +329,8 @@ static int DeleteFromInput( playlist_t *p_playlist, input_item_t *p_input,
playlist_item_t *p_item = playlist_ItemFindFromInputAndRoot(
p_playlist, p_input, p_root, false );
if( !p_item ) return VLC_EGENERIC;
return playlist_NodeDelete( p_playlist, p_item, true, false );
playlist_NodeDelete( p_playlist, p_item, true, false );
return VLC_SUCCESS;
}
/**
......@@ -402,7 +401,8 @@ int playlist_DeleteFromItemId( playlist_t *p_playlist, int i_id )
PL_ASSERT_LOCKED;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_id );
if( !p_item ) return VLC_EGENERIC;
return playlist_NodeDelete( p_playlist, p_item, true, false );
playlist_NodeDelete( p_playlist, p_item, true, false );
return VLC_SUCCESS;
}
/***************************************************************************
......
......@@ -134,9 +134,9 @@ playlist_item_t *playlist_ItemFindFromInputAndRoot( playlist_t *p_playlist,
int playlist_DeleteFromInputInParent( playlist_t *, input_item_t *,
playlist_item_t *, bool );
int playlist_DeleteFromItemId( playlist_t*, int );
int playlist_ItemRelease( playlist_item_t * );
void playlist_ItemRelease( playlist_item_t * );
int playlist_NodeEmpty( playlist_t *, playlist_item_t *, bool );
void playlist_NodeEmpty( playlist_t *, playlist_item_t *, bool );
void ResetCurrentlyPlaying( playlist_t *p_playlist, playlist_item_t *p_cur );
void ResyncCurrentIndex( playlist_t *p_playlist, playlist_item_t *p_cur );
......
......@@ -99,20 +99,17 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
* \param p_playlist the playlist
* \param p_root the node
* \param b_delete_items do we have to delete the children items ?
* \return VLC_SUCCESS or an error
*/
int playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root,
void playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root,
bool b_delete_items )
{
PL_ASSERT_LOCKED;
int i;
if( p_root->i_children == -1 )
{
return VLC_EGENERIC;
}
return;
/* Delete the children */
for( i = p_root->i_children-1 ; i >= 0 ;i-- )
for( int i = p_root->i_children-1 ; i >= 0 ;i-- )
{
if( p_root->pp_children[i]->i_children > -1 )
{
......@@ -126,7 +123,6 @@ int playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root,
p_root->pp_children[i]->i_id );
}
}
return VLC_SUCCESS;
}
/**
......@@ -135,10 +131,9 @@ int playlist_NodeEmpty( playlist_t *p_playlist, playlist_item_t *p_root,
* \param p_playlist the playlist
* \param p_root the node
* \param b_delete_items do we have to delete the children items ?
* \return VLC_SUCCESS or an error
*/
int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
bool b_delete_items, bool b_force )
void playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
bool b_delete_items, bool b_force )
{
PL_ASSERT_LOCKED;
......@@ -150,7 +145,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
/* Delete the node */
if( p_root->i_flags & PLAYLIST_RO_FLAG && !b_force )
return VLC_SUCCESS;
return;
pl_priv(p_playlist)->b_reset_currently_playing = true;
......@@ -187,7 +182,6 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
playlist_NodeRemoveItem( p_playlist, p_root, p_root->p_parent );
playlist_ItemRelease( p_root );
return VLC_SUCCESS;
}
......
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