[vlc-devel] [RFC 2/3] vlc_arrays: rename index_of_item() to find()
Romain Vimont
rom1v at videolabs.io
Thu Jul 19 17:57:17 CEST 2018
---
include/vlc_arrays.h | 4 ++--
lib/media_list.c | 2 +-
modules/control/dbus/dbus.c | 4 ++--
modules/mux/asf.c | 4 ++--
src/interface/dialog.c | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
index 00f816638f4..ce2936f1452 100644
--- a/include/vlc_arrays.h
+++ b/include/vlc_arrays.h
@@ -297,8 +297,8 @@ static inline const void *vlc_array_get( const vlc_array_t *ar,
}
#endif
-static inline ssize_t vlc_array_index_of_item( const vlc_array_t *ar,
- const void *elem )
+static inline ssize_t vlc_array_find( const vlc_array_t *ar,
+ const void *elem )
{
for( size_t i = 0; i < ar->i_count; i++ )
{
diff --git a/lib/media_list.c b/lib/media_list.c
index 10d0bf6d022..fdf387564a3 100644
--- a/lib/media_list.c
+++ b/lib/media_list.c
@@ -433,7 +433,7 @@ libvlc_media_list_item_at_index( libvlc_media_list_t * p_mlist,
int libvlc_media_list_index_of_item( libvlc_media_list_t * p_mlist,
libvlc_media_t * p_searched_md )
{
- int idx = vlc_array_index_of_item( &p_mlist->items, p_searched_md );
+ int idx = vlc_array_find( &p_mlist->items, p_searched_md );
if( idx == -1 )
libvlc_printerr( "Media not found" );
diff --git a/modules/control/dbus/dbus.c b/modules/control/dbus/dbus.c
index 39c3b12ac8d..6a1eae9965f 100644
--- a/modules/control/dbus/dbus.c
+++ b/modules/control/dbus/dbus.c
@@ -356,7 +356,7 @@ static void remove_timeout(DBusTimeout *to, void *data)
size_t idx;
vlc_mutex_lock(&sys->lock);
- idx = vlc_array_index_of_item(&sys->timeouts, to);
+ idx = vlc_array_find(&sys->timeouts, to);
vlc_array_remove(&sys->timeouts, idx);
vlc_mutex_unlock(&sys->lock);
}
@@ -461,7 +461,7 @@ static void remove_watch( DBusWatch *p_watch, void *p_data )
size_t idx;
vlc_mutex_lock( &p_sys->lock );
- idx = vlc_array_index_of_item( &p_sys->watches, p_watch );
+ idx = vlc_array_find( &p_sys->watches, p_watch );
vlc_array_remove( &p_sys->watches, idx );
vlc_mutex_unlock( &p_sys->lock );
}
diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index f60e37e01eb..6a0721d3342 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -629,7 +629,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
es_format_Copy( &tk->fmt, p_input->p_fmt );
- tk->i_id = vlc_array_index_of_item( &p_sys->tracks, tk ) + 1;
+ tk->i_id = vlc_array_find( &p_sys->tracks, tk ) + 1;
if( p_sys->b_asf_http )
p_sys->b_write_header = true;
@@ -667,7 +667,7 @@ static void DelStream( sout_mux_t *p_mux, sout_input_t *p_input )
if( p_sys->b_asf_http )
{
- vlc_array_remove( &p_sys->tracks, vlc_array_index_of_item( &p_sys->tracks, tk ) );
+ vlc_array_remove( &p_sys->tracks, vlc_array_find( &p_sys->tracks, tk ) );
p_sys->b_write_header = true;
}
}
diff --git a/src/interface/dialog.c b/src/interface/dialog.c
index 94c8caabfaf..e1b27b4ad7e 100644
--- a/src/interface/dialog.c
+++ b/src/interface/dialog.c
@@ -207,7 +207,7 @@ dialog_add_locked(vlc_dialog_provider *p_provider, enum dialog_type i_type)
static void
dialog_remove_locked(vlc_dialog_provider *p_provider, vlc_dialog_id *p_id)
{
- ssize_t i_idx = vlc_array_index_of_item(&p_provider->dialog_array, p_id);
+ ssize_t i_idx = vlc_array_find(&p_provider->dialog_array, p_id);
assert(i_idx >= 0);
vlc_array_remove(&p_provider->dialog_array, i_idx);
--
2.18.0
More information about the vlc-devel
mailing list