Changeset 04a4af73ffcb9602a697e5b2bd8df21c9e9b3c6d
- 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
| r6b42b42 |
r04a4af7 |
|
| 48 | 48 | global_stats_t *p_stats; ///< Global statistics |
|---|
| 49 | 49 | |
|---|
| 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 |
|---|
| 54 | 50 | |
|---|
| 55 | 51 | /* Structure storing the action name / key associations */ |
|---|
| r6da90a1 |
r04a4af7 |
|
| 184 | 184 | { |
|---|
| 185 | 185 | vlc_object_t *p_obj = (vlc_object_t *)p_this->p_destructor_arg; |
|---|
| | 186 | libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc); |
|---|
| 186 | 187 | input_item_t *p_input = (input_item_t *) p_this; |
|---|
| 187 | 188 | int i; |
|---|
| … | … | |
| 191 | 192 | vlc_mutex_lock( &p_obj->p_libvlc->object_lock ); |
|---|
| 192 | 193 | |
|---|
| 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); |
|---|
| 194 | 195 | if( i != -1 ) |
|---|
| 195 | | ARRAY_REMOVE( p_obj->p_libvlc->input_items, i); |
|---|
| | 196 | ARRAY_REMOVE( priv->input_items, i); |
|---|
| 196 | 197 | |
|---|
| 197 | 198 | vlc_mutex_unlock( &p_obj->p_libvlc->object_lock ); |
|---|
| … | … | |
| 302 | 303 | input_item_t *__input_ItemGetById( vlc_object_t *p_obj, int i_id ) |
|---|
| 303 | 304 | { |
|---|
| | 305 | libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc); |
|---|
| 304 | 306 | input_item_t * p_ret = NULL; |
|---|
| 305 | 307 | int i; |
|---|
| … | … | |
| 307 | 309 | vlc_mutex_lock( &p_obj->p_libvlc->object_lock ); |
|---|
| 308 | 310 | |
|---|
| 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); |
|---|
| 310 | 312 | if( i != -1 ) |
|---|
| 311 | | p_ret = ARRAY_VAL( p_obj->p_libvlc->input_items, i); |
|---|
| | 313 | p_ret = ARRAY_VAL( priv->input_items, i); |
|---|
| 312 | 314 | |
|---|
| 313 | 315 | vlc_mutex_unlock( &p_obj->p_libvlc->object_lock ); |
|---|
| … | … | |
| 335 | 337 | int i_type ) |
|---|
| 336 | 338 | { |
|---|
| | 339 | libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc); |
|---|
| | 340 | |
|---|
| 337 | 341 | DECMALLOC_NULL( p_input, input_item_t ); |
|---|
| 338 | 342 | |
|---|
| … | … | |
| 341 | 345 | |
|---|
| 342 | 346 | 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 ); |
|---|
| 345 | 349 | vlc_mutex_unlock( &p_obj->p_libvlc->object_lock ); |
|---|
| 346 | 350 | |
|---|
| r8d58301 |
r04a4af7 |
|
| 721 | 721 | |
|---|
| 722 | 722 | /* 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; |
|---|
| 725 | 725 | |
|---|
| 726 | 726 | /* |
|---|
| … | … | |
| 1004 | 1004 | |
|---|
| 1005 | 1005 | 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 ) |
|---|
| 1007 | 1007 | msg_Err( p_libvlc, "input item %p has not been deleted properly: refcount %d, name %s", |
|---|
| 1008 | 1008 | p_del, p_del->i_gc_refcount, p_del->psz_name ? p_del->psz_name : "(null)" ); |
|---|
| … | … | |
| 1010 | 1010 | FOREACH_END(); |
|---|
| 1011 | 1011 | assert( b_clean ); |
|---|
| 1012 | | ARRAY_RESET( p_libvlc->input_items ); |
|---|
| | 1012 | ARRAY_RESET( priv->input_items ); |
|---|
| 1013 | 1013 | |
|---|
| 1014 | 1014 | msg_Dbg( p_libvlc, "removing stats" ); |
|---|
| r6b42b42 |
r04a4af7 |
|
| 213 | 213 | char * psz_configfile; ///< location of config file |
|---|
| 214 | 214 | |
|---|
| | 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 | |
|---|
| 215 | 220 | /* Messages */ |
|---|
| 216 | 221 | msg_bank_t msg_bank; ///< The message bank |
|---|