[vlc-commits] lib: vlm: allocate event manager in-place
Rémi Denis-Courmont
git at videolan.org
Mon May 15 21:32:50 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 15 20:16:45 2017 +0300| [a7de129d4163dd3db89ff4b3e880e7e41dcdbdf5] | committer: Rémi Denis-Courmont
lib: vlm: allocate event manager in-place
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7de129d4163dd3db89ff4b3e880e7e41dcdbdf5
---
lib/vlm.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/lib/vlm.c b/lib/vlm.c
index 3c4efb5cfa..2c3b4d4079 100644
--- a/lib/vlm.c
+++ b/lib/vlm.c
@@ -36,8 +36,8 @@
typedef struct libvlc_vlm_t
{
+ libvlc_event_manager_t event_manager;
vlm_t *p_vlm;
- libvlc_event_manager_t *p_event_manager;
} libvlc_vlm_t;
/* VLM events callback. Transmit to libvlc */
@@ -117,9 +117,8 @@ void libvlc_vlm_release( libvlc_instance_t *p_instance )
vlm_Control( p_vlm, VLM_CLEAR_SCHEDULES );
var_DelCallback( (vlc_object_t *)p_vlm, "intf-event", VlmEvent,
- p_instance->vlm->p_event_manager );
- libvlc_event_manager_release( p_instance->vlm->p_event_manager );
- p_instance->vlm->p_event_manager = NULL;
+ &p_instance->vlm->event_manager );
+ libvlc_event_manager_destroy( &p_instance->vlm->event_manager );
vlm_Delete( p_vlm );
free( p_instance->vlm );
p_instance->vlm = NULL;
@@ -134,15 +133,8 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance )
if( p_instance->vlm == NULL )
return VLC_ENOMEM;
p_instance->vlm->p_vlm = NULL;
- p_instance->vlm->p_event_manager = NULL;
- }
-
- if( !p_instance->vlm->p_event_manager )
- {
- p_instance->vlm->p_event_manager =
- libvlc_event_manager_new( p_instance->vlm->p_vlm );
- if( unlikely(p_instance->vlm->p_event_manager == NULL) )
- return VLC_ENOMEM;
+ libvlc_event_manager_init( &p_instance->vlm->event_manager,
+ &p_instance->vlm->p_vlm );
}
if( !p_instance->vlm->p_vlm )
@@ -155,7 +147,7 @@ static int libvlc_vlm_init( libvlc_instance_t *p_instance )
}
var_AddCallback( (vlc_object_t *)p_instance->vlm->p_vlm,
"intf-event", VlmEvent,
- p_instance->vlm->p_event_manager );
+ &p_instance->vlm->event_manager );
libvlc_retain( p_instance );
}
@@ -748,5 +740,5 @@ libvlc_vlm_get_event_manager( libvlc_instance_t *p_instance )
{
if( libvlc_vlm_init( p_instance ) )
return NULL;
- return p_instance->vlm->p_event_manager;
+ return &p_instance->vlm->event_manager;
}
More information about the vlc-commits
mailing list