[vlc-commits] Use TAB_REMOVE instead of REMOVE_ELEM where applicable
Rémi Denis-Courmont
git at videolan.org
Thu May 18 20:22:13 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May 18 21:08:46 2017 +0300| [e1493bf272d593cf4235162b2f480675716fb998] | committer: Rémi Denis-Courmont
Use TAB_REMOVE instead of REMOVE_ELEM where applicable
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e1493bf272d593cf4235162b2f480675716fb998
---
modules/services_discovery/sap.c | 12 ++----------
src/input/item.c | 10 ++--------
src/playlist/tree.c | 11 +----------
3 files changed, 5 insertions(+), 28 deletions(-)
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index a8361efb2f..74bac2bb2f 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -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;
diff --git a/src/input/item.c b/src/input/item.c
index 92b473b79d..3dd21bbbd8 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -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 );
}
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 12e4154025..0dbcf70905 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -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 );
}
More information about the vlc-commits
mailing list