[vlc-commits] lib: media_list: allocate event manager in-place
Rémi Denis-Courmont
git at videolan.org
Mon May 15 21:32:21 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 15 20:16:45 2017 +0300| [3b31041cb74840424ad6ac9277daca73d18b9102] | committer: Rémi Denis-Courmont
lib: media_list: allocate event manager in-place
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b31041cb74840424ad6ac9277daca73d18b9102
---
lib/media_list.c | 21 +++++++--------------
lib/media_list_internal.h | 2 +-
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/lib/media_list.c b/lib/media_list.c
index 5274969f70..5567567b07 100644
--- a/lib/media_list.c
+++ b/lib/media_list.c
@@ -78,7 +78,7 @@ notify_item_addition( libvlc_media_list_t * p_mlist,
}
/* Send the event */
- libvlc_event_send( p_mlist->p_event_manager, &event );
+ libvlc_event_send( &p_mlist->event_manager, &event );
}
/**************************************************************************
@@ -109,7 +109,7 @@ notify_item_deletion( libvlc_media_list_t * p_mlist,
}
/* Send the event */
- libvlc_event_send( p_mlist->p_event_manager, &event );
+ libvlc_event_send( &p_mlist->event_manager, &event );
}
/* LibVLC internal */
@@ -120,7 +120,7 @@ void libvlc_media_list_internal_end_reached( libvlc_media_list_t * p_mlist )
event.type = libvlc_MediaListEndReached;
/* Send the event */
- libvlc_event_send( p_mlist->p_event_manager, &event );
+ libvlc_event_send( &p_mlist->event_manager, &event );
}
/**************************************************************************
@@ -160,13 +160,7 @@ libvlc_media_list_new( libvlc_instance_t * p_inst )
}
p_mlist->p_libvlc_instance = p_inst;
- p_mlist->p_event_manager = libvlc_event_manager_new( p_mlist );
- if( unlikely(p_mlist->p_event_manager == NULL) )
- {
- free(p_mlist);
- return NULL;
- }
-
+ libvlc_event_manager_init( &p_mlist->event_manager, p_mlist );
p_mlist->b_read_only = false;
vlc_mutex_init( &p_mlist->object_lock );
@@ -200,8 +194,7 @@ void libvlc_media_list_release( libvlc_media_list_t * p_mlist )
/* Refcount null, time to free */
- libvlc_event_manager_release( p_mlist->p_event_manager );
-
+ libvlc_event_manager_destroy( &p_mlist->event_manager );
libvlc_media_release( p_mlist->p_md );
for( size_t i = 0; i < vlc_array_count( &p_mlist->items ); i++ )
@@ -481,12 +474,12 @@ void libvlc_media_list_unlock( libvlc_media_list_t * p_mlist )
/**************************************************************************
- * libvlc_media_list_p_event_manager (Public)
+ * libvlc_media_list_event_manager (Public)
*
* The p_event_manager is immutable, so you don't have to hold the lock
**************************************************************************/
libvlc_event_manager_t *
libvlc_media_list_event_manager( libvlc_media_list_t * p_mlist )
{
- return p_mlist->p_event_manager;
+ return &p_mlist->event_manager;
}
diff --git a/lib/media_list_internal.h b/lib/media_list_internal.h
index ded1efc111..dd95703dc8 100644
--- a/lib/media_list_internal.h
+++ b/lib/media_list_internal.h
@@ -36,7 +36,7 @@
struct libvlc_media_list_t
{
- libvlc_event_manager_t * p_event_manager;
+ libvlc_event_manager_t event_manager;
libvlc_instance_t * p_libvlc_instance;
int i_refcount;
vlc_mutex_t object_lock;
More information about the vlc-commits
mailing list