Use TAB_REMOVE instead of REMOVE_ELEM where applicable
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 18 May 2017 18:08:46 +0000 (21:08 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 18 May 2017 18:22:22 +0000 (21:22 +0300)
modules/services_discovery/sap.c
src/input/item.c
src/playlist/tree.c

index a8361ef..74bac2b 100644 (file)
@@ -1564,16 +1564,8 @@ static int RemoveAnnounce( services_discovery_t *p_sd,
         p_announce->p_item = NULL;
     }
 
-    for( i = 0; i< p_sd->p_sys->i_announces; i++)
-    {
-        if( p_sd->p_sys->pp_announces[i] == p_announce )
-        {
-            REMOVE_ELEM( p_sd->p_sys->pp_announces, p_sd->p_sys->i_announces,
-                         i);
-            break;
-        }
-    }
-
+    TAB_REMOVE(p_sd->p_sys->i_announces, p_sd->p_sys->pp_announces,
+               p_announce);
     free( p_announce );
 
     return VLC_SUCCESS;
index 92b473b..3dd21bb 100644 (file)
@@ -1261,14 +1261,8 @@ static void RecursiveNodeDelete( input_item_node_t *p_node )
 void input_item_node_Delete( input_item_node_t *p_node )
 {
     if( p_node->p_parent )
-        for( int i = 0; i < p_node->p_parent->i_children; i++ )
-            if( p_node->p_parent->pp_children[i] == p_node )
-            {
-                REMOVE_ELEM( p_node->p_parent->pp_children,
-                        p_node->p_parent->i_children,
-                        i );
-                break;
-            }
+        TAB_REMOVE(p_node->p_parent->i_children, p_node->p_parent->pp_children,
+                   p_node);
 
     RecursiveNodeDelete( p_node );
 }
index 12e4154..0dbcf70 100644 (file)
@@ -131,16 +131,7 @@ void playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
     /* Remove the item from its parent */
     playlist_item_t *p_parent = p_root->p_parent;
     if( p_parent != NULL )
-    {
-        for( int i = 0; i < p_parent->i_children ; i++ )
-        {
-            if( p_parent->pp_children[i] == p_root )
-            {
-                REMOVE_ELEM( p_parent->pp_children, p_parent->i_children, i );
-                assert( p_root->p_parent == p_parent );
-            }
-        }
-    }
+        TAB_REMOVE(p_parent->i_children, p_parent->pp_children, p_root);
 
     playlist_ItemRelease( p_playlist, p_root );
 }