]> git.sesse.net Git - vlc/commitdiff
Remove the unsafe input item array
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 20 Sep 2008 09:50:02 +0000 (12:50 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 20 Sep 2008 09:51:18 +0000 (12:51 +0300)
include/vlc_input.h
src/input/item.c
src/libvlc.c
src/libvlc.h
src/libvlccore.sym

index dc812485c597d0ab92029ff99df232d4482eb237..b4010d35194b63f13f019738af386f207816b42b 100644 (file)
@@ -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
  *****************************************************************************/
index 4dc62c52378344835265f494457dd5ead956ad1f..9f0634715b969e6fa106db1dab427a8403ae93fd 100644 (file)
@@ -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;
 
index 07347a1145c32cc3953d1c0ffa3db37532045557..b7c9e6304edeba934751677a463cb1ab669d5036 100644 (file)
@@ -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 );
index a4e48517aaa95dc032e46c92cdfa11bfd0d3bfc6..53d9dbd722b4e013e37775d42787028071f454d6 100644 (file)
@@ -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
index 7760fef363c0c1ba6cae0e234b5853885fd9dee5..f428bd1a7a9180ed0e1ad1d747a56db043475597 100644 (file)
@@ -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