int i_position )
{
PL_ASSERT_LOCKED;
- (void)p_playlist;
- assert( p_parent && p_parent->i_children != -1 );
- if( i_position == -1 ) i_position = p_parent->i_children ;
- assert( i_position <= p_parent->i_children);
-
- INSERT_ELEM( p_parent->pp_children,
- p_parent->i_children,
- i_position,
- p_item );
- p_item->p_parent = p_parent;
- return VLC_SUCCESS;
+ (void)p_playlist;
+ assert( p_parent && p_parent->i_children != -1 );
+ if( i_position == -1 ) i_position = p_parent->i_children ;
+ assert( i_position <= p_parent->i_children);
+
+ INSERT_ELEM( p_parent->pp_children,
+ p_parent->i_children,
+ i_position,
+ p_item );
+ p_item->p_parent = p_parent;
+ return VLC_SUCCESS;
}
/**
playlist_item_t *p_parent )
{
PL_ASSERT_LOCKED;
- (void)p_playlist;
+ (void)p_playlist;
- 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 );
- }
- }
+ 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 VLC_SUCCESS;
+ return ret;
}
/**