[vlc-commits] input: remove non-portable function cast

Rémi Denis-Courmont git at videolan.org
Sun Jun 7 21:43:50 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  6 21:18:25 2015 +0300| [80cd00cbce2575d663de9bfb1472fa7617954096] | committer: Rémi Denis-Courmont

input: remove non-portable function cast

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=80cd00cbce2575d663de9bfb1472fa7617954096
---

 src/input/input.c |   73 ++++++++++++++++++++++++++---------------------------
 1 file changed, 36 insertions(+), 37 deletions(-)

diff --git a/src/input/input.c b/src/input/input.c
index 5b1327c..fc15b7a 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -58,8 +58,6 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static void Destructor( input_thread_t * p_input );
-
 static  void *Run            ( void * );
 
 static input_thread_t * Create  ( vlc_object_t *, input_item_t *,
@@ -261,6 +259,41 @@ void input_Close( input_thread_t *p_input )
 }
 
 /**
+ * Input destructor (called when the object's refcount reaches 0).
+ */
+static void input_Destructor( vlc_object_t *obj )
+{
+    input_thread_t *p_input = (input_thread_t *)obj;
+#ifndef NDEBUG
+    char * psz_name = input_item_GetName( p_input->p->p_item );
+    msg_Dbg( p_input, "Destroying the input for '%s'", psz_name);
+    free( psz_name );
+#endif
+
+    if( p_input->p->p_es_out_display )
+        es_out_Delete( p_input->p->p_es_out_display );
+
+    if( p_input->p->p_resource )
+        input_resource_Release( p_input->p->p_resource );
+    if( p_input->p->p_resource_private )
+        input_resource_Release( p_input->p->p_resource_private );
+
+    vlc_gc_decref( p_input->p->p_item );
+
+    vlc_mutex_destroy( &p_input->p->counters.counters_lock );
+
+    for( int i = 0; i < p_input->p->i_control; i++ )
+    {
+        input_control_t *p_ctrl = &p_input->p->control[i];
+        ControlRelease( p_ctrl->i_type, p_ctrl->val );
+    }
+
+    vlc_cond_destroy( &p_input->p->wait_control );
+    vlc_mutex_destroy( &p_input->p->lock_control );
+    free( p_input->p );
+}
+
+/**
  * Get the item from an input thread
  * FIXME it does not increase ref count of the item.
  * if it is used after p_input is destroyed nothing prevent it from
@@ -472,45 +505,11 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     p_input->p->p_es_out = NULL;
 
     /* Set the destructor when we are sure we are initialized */
-    vlc_object_set_destructor( p_input, (vlc_destructor_t)Destructor );
+    vlc_object_set_destructor( p_input, input_Destructor );
 
     return p_input;
 }
 
-/**
- * Input destructor (called when the object's refcount reaches 0).
- */
-static void Destructor( input_thread_t * p_input )
-{
-#ifndef NDEBUG
-    char * psz_name = input_item_GetName( p_input->p->p_item );
-    msg_Dbg( p_input, "Destroying the input for '%s'", psz_name);
-    free( psz_name );
-#endif
-
-    if( p_input->p->p_es_out_display )
-        es_out_Delete( p_input->p->p_es_out_display );
-
-    if( p_input->p->p_resource )
-        input_resource_Release( p_input->p->p_resource );
-    if( p_input->p->p_resource_private )
-        input_resource_Release( p_input->p->p_resource_private );
-
-    vlc_gc_decref( p_input->p->p_item );
-
-    vlc_mutex_destroy( &p_input->p->counters.counters_lock );
-
-    for( int i = 0; i < p_input->p->i_control; i++ )
-    {
-        input_control_t *p_ctrl = &p_input->p->control[i];
-        ControlRelease( p_ctrl->i_type, p_ctrl->val );
-    }
-
-    vlc_cond_destroy( &p_input->p->wait_control );
-    vlc_mutex_destroy( &p_input->p->lock_control );
-    free( p_input->p );
-}
-
 /*****************************************************************************
  * Run: main thread loop
  * This is the "normal" thread that spawns the input processing chain,



More information about the vlc-commits mailing list