[vlc-devel] commit: Remove the unsafe input item array ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat Sep 20 12:00:51 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Sep 20 12:50:02 2008 +0300| [513a8db0a09a2bcacb4310b55d982945ca5de3f8] | committer: Rémi Denis-Courmont 

Remove the unsafe input item array

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=513a8db0a09a2bcacb4310b55d982945ca5de3f8
---

 include/vlc_input.h |    4 ----
 src/input/item.c    |   37 -------------------------------------
 src/libvlc.c        |   13 -------------
 src/libvlc.h        |    5 -----
 src/libvlccore.sym  |    1 -
 5 files changed, 0 insertions(+), 60 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index dc81248..b4010d3 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -60,7 +60,6 @@ struct input_item_t
 {
     VLC_GC_MEMBERS
     int        i_id;                 /**< Identifier of the item */
-    libvlc_int_t *p_libvlc;
 
     char       *psz_name;            /**< text describing this item */
     char       *psz_uri;             /**< mrl of this item */
@@ -187,9 +186,6 @@ VLC_EXPORT(int, input_item_AddInfo, ( input_item_t *p_i, const char *psz_cat, co
 VLC_EXPORT( input_item_t *, __input_item_NewExt, (vlc_object_t *, const char *, const char*, int, const char *const *, mtime_t i_duration )  );
 VLC_EXPORT( input_item_t *, input_item_NewWithType, ( vlc_object_t *, const char *, const char *e, int, const char *const *, mtime_t i_duration, int ) );
 
-#define input_item_GetById(a,b) __input_item_GetById( VLC_OBJECT(a),b )
-VLC_EXPORT( input_item_t *, __input_item_GetById, (vlc_object_t *, int ) );
-
 /*****************************************************************************
  * Meta data helpers
  *****************************************************************************/
diff --git a/src/input/item.c b/src/input/item.c
index 4dc62c5..9f06347 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -370,22 +370,8 @@ char *input_item_GetInfo( input_item_t *p_i,
 static void input_item_Destroy ( gc_object_t *gc )
 {
     input_item_t *p_input = vlc_priv(gc, input_item_t);
-    libvlc_int_t *p_libvlc = p_input->p_libvlc;
-    int i;
 
     input_item_Clean( p_input );
-
-    /* This is broken. Items must be removed from any table before their
-     * reference count drops to zero (unless the table is not used, but then
-     * why have it?). Full point, no buts. -- Courmisch */
-    libvlc_priv_t *priv = libvlc_priv (p_libvlc);
-    vlc_object_lock( p_libvlc );
-
-    ARRAY_BSEARCH( priv->input_items,->i_id, int, p_input->i_id, i);
-    if( i != -1 )
-        ARRAY_REMOVE( priv->input_items, i);
-
-    vlc_object_unlock( p_libvlc );
     free( p_input );
 }
 
@@ -489,23 +475,6 @@ int input_item_AddInfo( input_item_t *p_i,
     return p_info->psz_value ? VLC_SUCCESS : VLC_ENOMEM;
 }
 
-input_item_t *__input_item_GetById( vlc_object_t *p_obj, int i_id )
-{
-    libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
-    input_item_t * p_ret = NULL;
-    int i;
-
-    vlc_object_lock( p_obj->p_libvlc );
-
-    ARRAY_BSEARCH( priv->input_items, ->i_id, int, i_id, i);
-    if( i != -1 )
-        p_ret = ARRAY_VAL( priv->input_items, i);
-
-    vlc_object_unlock( p_obj->p_libvlc );
-
-    return p_ret;
-}
-
 input_item_t *__input_item_NewExt( vlc_object_t *p_obj, const char *psz_uri,
                                   const char *psz_name,
                                   int i_options,
@@ -531,12 +500,6 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
 
     input_item_Init( p_obj, p_input );
     vlc_gc_init( p_input, input_item_Destroy );
-    p_input->p_libvlc = p_obj->p_libvlc;
-
-    vlc_object_lock( p_obj->p_libvlc );
-    p_input->i_id = ++priv->i_last_input_id;
-    ARRAY_APPEND( priv->input_items, p_input );
-    vlc_object_unlock( p_obj->p_libvlc );
 
     p_input->b_fixed_name = false;
 
diff --git a/src/libvlc.c b/src/libvlc.c
index 07347a1..b7c9e63 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -807,10 +807,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     vlc_mutex_init( &p_libvlc->p_stats->lock );
     priv->p_stats_computer = NULL;
 
-    /* Init the array that holds every input item */
-    ARRAY_INIT( priv->input_items );
-    priv->i_last_input_id = 0;
-
     /*
      * Initialize hotkey handling
      */
@@ -1077,15 +1073,6 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
     stats_TimersDumpAll( p_libvlc );
     stats_TimersCleanAll( p_libvlc );
 
-    bool b_clean = true;
-    FOREACH_ARRAY( input_item_t *p_del, priv->input_items )
-        msg_Err( p_libvlc, "input item %p has not been deleted properly: name %s",
-            p_del, p_del->psz_name ? p_del->psz_name : "(null)" );
-        b_clean = false;
-    FOREACH_END();
-    assert( b_clean );
-    ARRAY_RESET( priv->input_items );
-
     msg_Dbg( p_libvlc, "removing stats" );
     vlc_mutex_destroy( &p_libvlc->p_stats->lock );
     FREENULL( p_libvlc->p_stats );
diff --git a/src/libvlc.h b/src/libvlc.h
index a4e4851..53d9dbd 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -206,11 +206,6 @@ typedef struct libvlc_priv_t
     vlc_mutex_t        config_lock; ///< config file lock
     char *             psz_configfile;   ///< location of config file
 
-    /* There is no real reason to keep a list of items, but not to break
-     * everything, let's keep it */
-    input_item_array_t input_items; ///< Array of all created input items
-    int                i_last_input_id ; ///< Last id of input item
-
     /* Messages */
     msg_bank_t         msg_bank;    ///< The message bank
     int                i_verbose;   ///< info messages
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 7760fef..f428bd1 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -160,7 +160,6 @@ input_item_AddOpt
 input_item_AddOption
 input_item_AddSubItem
 input_item_CopyOptions
-__input_item_GetById
 input_item_GetDuration
 input_item_GetInfo
 input_item_GetMeta




More information about the vlc-devel mailing list