]> git.sesse.net Git - vlc/blobdiff - src/playlist/tree.c
Introduce realloc_or_free() to src/*, and add assert() to mark unhandled ENOMEM error...
[vlc] / src / playlist / tree.c
index 3e123008e8db08cbc885d0e808b9252a90e4085e..9937d0d927b9f08391beba77e1ae5df3d52cc261 100644 (file)
@@ -144,7 +144,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
     }
 
     /* Delete the children */
-    for( i =  p_root->i_children - 1 ; i >= 0; i-- )
+    for( i = p_root->i_children - 1 ; i >= 0; i-- )
     {
         if( p_root->pp_children[i]->i_children > -1 )
         {
@@ -164,7 +164,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
     else
     {
         int i;
-        var_SetInteger( p_playlist, "item-deleted", p_root->i_id );
+        var_SetInteger( p_playlist, "playlist-item-deleted", p_root->i_id );
         ARRAY_BSEARCH( p_playlist->all_items, ->i_id, int,
                        p_root->i_id, i );
         if( i != -1 )
@@ -311,8 +311,8 @@ playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
             return p_node;
         for( i = 0 ; i< p_playlist->p_root_onelevel->i_children; i++ )
         {
-            if( p_playlist->p_root_onelevel->pp_children[i]->p_input->i_id ==
-                    p_node->p_input->i_id )
+            if( p_playlist->p_root_onelevel->pp_children[i]->p_input ==
+                    p_node->p_input )
                 return p_playlist->p_root_onelevel->pp_children[i];
         }
     }
@@ -322,8 +322,8 @@ playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
             return p_node;
         for( i = 0 ; i< p_playlist->p_root_category->i_children; i++ )
         {
-            if( p_playlist->p_root_category->pp_children[i]->p_input->i_id ==
-                    p_node->p_input->i_id )
+            if( p_playlist->p_root_category->pp_children[i]->p_input ==
+                    p_node->p_input )
                 return p_playlist->p_root_category->pp_children[i];
         }
     }
@@ -333,30 +333,6 @@ playlist_item_t * playlist_GetPreferredNode( playlist_t *p_playlist,
 /**********************************************************************
  * Tree walking functions
  **********************************************************************/
-
-playlist_item_t *playlist_GetLastLeaf(playlist_t *p_playlist,
-                                      playlist_item_t *p_root )
-{
-    PL_ASSERT_LOCKED;
-    int i;
-    playlist_item_t *p_item;
-    for ( i = p_root->i_children - 1; i >= 0; i-- )
-    {
-        if( p_root->pp_children[i]->i_children == -1 )
-            return p_root->pp_children[i];
-        else if( p_root->pp_children[i]->i_children > 0)
-        {
-             p_item = playlist_GetLastLeaf( p_playlist,
-                                            p_root->pp_children[i] );
-            if ( p_item != NULL )
-                return p_item;
-        }
-        else if( i == 0 )
-            return NULL;
-    }
-    return NULL;
-}
-
 /**
  * Finds the next item to play
  *
@@ -415,7 +391,7 @@ playlist_item_t *playlist_GetPrevLeaf( playlist_t *p_playlist,
     PL_ASSERT_LOCKED;
     playlist_item_t *p_prev;
 
-    PL_DEBUG2( "finding previous os %s within %s", PLI_NAME( p_item ),
+    PL_DEBUG2( "finding previous of %s within %s", PLI_NAME( p_item ),
                                                    PLI_NAME( p_root ) );
     assert( p_root && p_root->i_children != -1 );