Changeset 04a4af73ffcb9602a697e5b2bd8df21c9e9b3c6d

Show
Ignore:
Timestamp:
05/05/08 22:34:21 (2 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1210019661 +0300
git-parent:

[f3cf5c6ef8f03bd8b9cb99a095c9072d76608181]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1210015040 +0300
Message:

The input_items array is private data.

Hide it before someone thinks (s)he can use it without locking libvlc.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_main.h

    r6b42b42 r04a4af7  
    4848    global_stats_t       *p_stats;           ///< Global statistics 
    4949 
    50     /* There is no real reason to keep a list of items, but not to break 
    51      * everything, let's keep it */ 
    52     input_item_array_t    input_items;       ///< Array of all created input items 
    53     int                   i_last_input_id ;  ///< Last id of input item 
    5450 
    5551    /* Structure storing the action name / key associations */ 
  • src/input/item.c

    r6da90a1 r04a4af7  
    184184{ 
    185185    vlc_object_t *p_obj = (vlc_object_t *)p_this->p_destructor_arg; 
     186    libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc); 
    186187    input_item_t *p_input = (input_item_t *) p_this; 
    187188    int i; 
     
    191192    vlc_mutex_lock( &p_obj->p_libvlc->object_lock ); 
    192193 
    193     ARRAY_BSEARCH( p_obj->p_libvlc->input_items,->i_id, int, p_input->i_id, i); 
     194    ARRAY_BSEARCH( priv->input_items,->i_id, int, p_input->i_id, i); 
    194195    if( i != -1 ) 
    195         ARRAY_REMOVE( p_obj->p_libvlc->input_items, i); 
     196        ARRAY_REMOVE( priv->input_items, i); 
    196197 
    197198    vlc_mutex_unlock( &p_obj->p_libvlc->object_lock ); 
     
    302303input_item_t *__input_ItemGetById( vlc_object_t *p_obj, int i_id ) 
    303304{ 
     305    libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc); 
    304306    input_item_t * p_ret = NULL; 
    305307    int i; 
     
    307309    vlc_mutex_lock( &p_obj->p_libvlc->object_lock ); 
    308310 
    309     ARRAY_BSEARCH( p_obj->p_libvlc->input_items, ->i_id, int, i_id, i); 
     311    ARRAY_BSEARCH( priv->input_items, ->i_id, int, i_id, i); 
    310312    if( i != -1 ) 
    311         p_ret = ARRAY_VAL( p_obj->p_libvlc->input_items, i); 
     313        p_ret = ARRAY_VAL( priv->input_items, i); 
    312314 
    313315    vlc_mutex_unlock( &p_obj->p_libvlc->object_lock ); 
     
    335337                                int i_type ) 
    336338{ 
     339    libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc); 
     340 
    337341    DECMALLOC_NULL( p_input, input_item_t ); 
    338342 
     
    341345 
    342346    vlc_mutex_lock( &p_obj->p_libvlc->object_lock ); 
    343     p_input->i_id = ++p_obj->p_libvlc->i_last_input_id; 
    344     ARRAY_APPEND( p_obj->p_libvlc->input_items, p_input ); 
     347    p_input->i_id = ++priv->i_last_input_id; 
     348    ARRAY_APPEND( priv->input_items, p_input ); 
    345349    vlc_mutex_unlock( &p_obj->p_libvlc->object_lock ); 
    346350 
  • src/libvlc-common.c

    r8d58301 r04a4af7  
    721721 
    722722    /* Init the array that holds every input item */ 
    723     ARRAY_INIT( p_libvlc->input_items ); 
    724     p_libvlc->i_last_input_id = 0; 
     723    ARRAY_INIT( priv->input_items ); 
     724    priv->i_last_input_id = 0; 
    725725 
    726726    /* 
     
    10041004 
    10051005    bool b_clean = true; 
    1006     FOREACH_ARRAY( input_item_t *p_del, p_libvlc->input_items ) 
     1006    FOREACH_ARRAY( input_item_t *p_del, priv->input_items ) 
    10071007        msg_Err( p_libvlc, "input item %p has not been deleted properly: refcount %d, name %s", 
    10081008            p_del, p_del->i_gc_refcount, p_del->psz_name ? p_del->psz_name : "(null)" ); 
     
    10101010    FOREACH_END(); 
    10111011    assert( b_clean ); 
    1012     ARRAY_RESET( p_libvlc->input_items ); 
     1012    ARRAY_RESET( priv->input_items ); 
    10131013 
    10141014    msg_Dbg( p_libvlc, "removing stats" ); 
  • src/libvlc.h

    r6b42b42 r04a4af7  
    213213    char *             psz_configfile;   ///< location of config file 
    214214 
     215    /* There is no real reason to keep a list of items, but not to break 
     216     * everything, let's keep it */ 
     217    input_item_array_t input_items; ///< Array of all created input items 
     218    int                i_last_input_id ; ///< Last id of input item 
     219 
    215220    /* Messages */ 
    216221    msg_bank_t         msg_bank;    ///< The message bank