[vlc-commits] playlist: privatize all_items array
Rémi Denis-Courmont
git at videolan.org
Tue Nov 15 22:19:39 CET 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 15 22:57:43 2016 +0200| [2575bf38f484da882d418171819373daa56bf522] | committer: Rémi Denis-Courmont
playlist: privatize all_items array
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2575bf38f484da882d418171819373daa56bf522
---
include/vlc_playlist.h | 1 -
src/playlist/engine.c | 6 +++---
src/playlist/item.c | 2 +-
src/playlist/playlist_internal.h | 2 ++
src/playlist/search.c | 11 +++++------
src/playlist/tree.c | 6 +++---
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/include/vlc_playlist.h b/include/vlc_playlist.h
index 79fd3ea..9fc237c 100644
--- a/include/vlc_playlist.h
+++ b/include/vlc_playlist.h
@@ -165,7 +165,6 @@ struct playlist_t
VLC_COMMON_MEMBERS
playlist_item_array_t items; /**< Arrays of items */
- playlist_item_array_t all_items; /**< Array of items and nodes */
playlist_item_array_t current; /**< Items currently being played */
int i_current_index; /**< Index in current array */
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index f26bf44..85f77e9 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -221,7 +221,7 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
pl_priv(p_playlist)->p_input = NULL;
ARRAY_INIT( p_playlist->items );
- ARRAY_INIT( p_playlist->all_items );
+ ARRAY_INIT( p->all_items );
ARRAY_INIT( p_playlist->current );
p_playlist->i_current_index = 0;
@@ -331,12 +331,12 @@ void playlist_Destroy( playlist_t *p_playlist )
vlc_mutex_destroy( &p_sys->lock );
/* Remove all remaining items */
- FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
+ FOREACH_ARRAY( playlist_item_t *p_del, p_sys->all_items )
free( p_del->pp_children );
vlc_gc_decref( p_del->p_input );
free( p_del );
FOREACH_END();
- ARRAY_RESET( p_playlist->all_items );
+ ARRAY_RESET( p_sys->all_items );
ARRAY_RESET( p_playlist->items );
ARRAY_RESET( p_playlist->current );
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 3127cf3..50ea1c2 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -820,7 +820,7 @@ static void AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
{
PL_ASSERT_LOCKED;
ARRAY_APPEND(p_playlist->items, p_item);
- ARRAY_APPEND(p_playlist->all_items, p_item);
+ ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
if( i_pos == PLAYLIST_END )
playlist_NodeAppend( p_playlist, p_item, p_node );
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index 63e1a91..a9a0bc0 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -49,6 +49,8 @@ typedef struct playlist_private_t
playlist_t public_data;
struct intf_thread_t *interface; /**< Linked-list of interfaces */
+ playlist_item_array_t all_items; /**< Array of items and nodes */
+
vlc_sd_internal_t **pp_sds;
int i_sds; /**< Number of service discovery modules */
input_thread_t * p_input; /**< the input thread associated
diff --git a/src/playlist/search.c b/src/playlist/search.c
index b72c712..0853b92 100644
--- a/src/playlist/search.c
+++ b/src/playlist/search.c
@@ -45,9 +45,9 @@ playlist_item_t* playlist_ItemGetById( playlist_t * p_playlist , int i_id )
{
int i;
PL_ASSERT_LOCKED;
- ARRAY_BSEARCH( p_playlist->all_items,->i_id, int, i_id, i );
+ ARRAY_BSEARCH( pl_priv(p_playlist)->all_items,->i_id, int, i_id, i );
if( i != -1 )
- return ARRAY_VAL( p_playlist->all_items, i );
+ return ARRAY_VAL( pl_priv(p_playlist)->all_items, i );
else
return NULL;
}
@@ -62,7 +62,6 @@ playlist_item_t* playlist_ItemGetById( playlist_t * p_playlist , int i_id )
playlist_item_t* playlist_ItemGetByInput( playlist_t * p_playlist,
const input_item_t *p_item )
{
- int i;
PL_ASSERT_LOCKED;
if( get_current_status_item( p_playlist ) &&
get_current_status_item( p_playlist )->p_input == p_item )
@@ -70,11 +69,11 @@ playlist_item_t* playlist_ItemGetByInput( playlist_t * p_playlist,
return get_current_status_item( p_playlist );
}
/** \todo Check if this is always incremental and whether we can bsearch */
- for( i = 0 ; i < p_playlist->all_items.i_size; i++ )
+ for( int i = 0 ; i < pl_priv(p_playlist)->all_items.i_size; i++ )
{
- if( ARRAY_VAL(p_playlist->all_items, i)->p_input == p_item )
+ if( ARRAY_VAL(pl_priv(p_playlist)->all_items, i)->p_input == p_item )
{
- return ARRAY_VAL(p_playlist->all_items, i);
+ return ARRAY_VAL(pl_priv(p_playlist)->all_items, i);
}
}
return NULL;
diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index e44e7a8..d67d373 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -77,7 +77,7 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist,
if( p_item == NULL ) return NULL;
p_item->i_children = 0;
- ARRAY_APPEND(p_playlist->all_items, p_item);
+ ARRAY_APPEND(pl_priv(p_playlist)->all_items, p_item);
if( p_parent != NULL )
playlist_NodeInsert( p_playlist, p_item, p_parent,
@@ -156,9 +156,9 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
int i;
var_SetInteger( p_playlist, "playlist-item-deleted", p_root->i_id );
- ARRAY_BSEARCH( p_playlist->all_items, ->i_id, int, p_root->i_id, i );
+ ARRAY_BSEARCH( pl_priv(p_playlist)->all_items, ->i_id, int, p_root->i_id, i );
if( i != -1 )
- ARRAY_REMOVE( p_playlist->all_items, i );
+ ARRAY_REMOVE( pl_priv(p_playlist)->all_items, i );
if( p_root->i_children == -1 ) {
ARRAY_BSEARCH( p_playlist->items,->i_id, int, p_root->i_id, i );
More information about the vlc-commits
mailing list