]> git.sesse.net Git - vlc/commitdiff
- Order : if a then b are initialized, release b then a ;
authorHenri Fallon <henri@videolan.org>
Sun, 7 Jan 2001 04:31:18 +0000 (04:31 +0000)
committerHenri Fallon <henri@videolan.org>
Sun, 7 Jan 2001 04:31:18 +0000 (04:31 +0000)
- Typos ;
- Cosmetic changes.

include/threads.h
src/audio_output/audio_output.c
src/input/input.c
src/input/input_programs.c
src/misc/modules.c
src/video_output/video_output.c
src/video_parser/video_parser.c

index 7d195508dc6f477355f0b6d85bcf2e6b4387cb42..6157a66752e978359d4bea0b07d3b257ba5cfc90 100644 (file)
@@ -152,7 +152,10 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
                                          char *psz_name, vlc_thread_func_t func,
                                          void *p_data)
 {
-#if defined(HAVE_CTHREADS_H)
+#if defined(HAVE_PTHREAD_H)
+    return pthread_create( p_thread, NULL, func, p_data );
+
+#elif defined(HAVE_CTHREADS_H)
     *p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
     return 0;
 
@@ -161,9 +164,6 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
                               B_NORMAL_PRIORITY, p_data );
     return resume_thread( *p_thread );
 
-#elif defined(HAVE_PTHREAD_H)
-    return pthread_create( p_thread, NULL, func, p_data );
-
 #endif
 }
 
@@ -281,7 +281,7 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
 }
 
 /*****************************************************************************
- * vlc_mutex_destroy: destory a mutex
+ * vlc_mutex_destroy: destroy a mutex
  *****************************************************************************/
 static __inline__ int vlc_mutex_destroy( vlc_mutex_t *p_mutex )
 {
@@ -403,7 +403,7 @@ static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex
 }
 
 /*****************************************************************************
- * vlc_cond_destory: destroy a condition
+ * vlc_cond_destroy: destroy a condition
  *****************************************************************************/
 static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar )
 {
index 473857bc5199a949da2cfcdd54551f454bc83f66..9c1af062af66e17925051518148395b0bcb2c784 100644 (file)
@@ -355,12 +355,12 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
     free( p_aout->s32_buffer );
 
     /* Destroy the condition and mutex locks */
-    vlc_mutex_destroy( &p_aout->fifos_lock );
     for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
     {
         vlc_mutex_destroy( &p_aout->fifo[i_fifo].data_lock );
         vlc_cond_destroy( &p_aout->fifo[i_fifo].data_wait );
     }
+    vlc_mutex_destroy( &p_aout->fifos_lock );
     
     /* Free the structure */
     p_aout->p_sys_close( p_aout );
index 1edfcd777dbefe3df005bd76fd71adccee7a4628..b02301d8f7e8eedb3943745c8d1dcc6661d94781 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input.c,v 1.66 2001/01/07 03:56:40 henri Exp $
+ * $Id: input.c,v 1.67 2001/01/07 04:31:18 henri Exp $
  *
  * Authors: 
  *
@@ -319,8 +319,8 @@ static void EndThread( input_thread_t * p_input )
     free( p_input->p_plugin );
 
     /* Destroy Mutex locks */
-    vlc_mutex_destroy( &p_input->stream.stream_lock );
     vlc_mutex_destroy( &p_input->stream.control.control_lock );
+    vlc_mutex_destroy( &p_input->stream.stream_lock );
     
     /* Free input structure */
     free( p_input );
index 5cd3b4a4b2bbe28b569193f81e6f8c14f57baab4..108eed1f84ebb8c8e6376045fb03e81770c58df2 100644 (file)
@@ -2,7 +2,7 @@
  * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_programs.c,v 1.19 2001/01/07 03:56:40 henri Exp $
+ * $Id: input_programs.c,v 1.20 2001/01/07 04:31:18 henri Exp $
  *
  * Authors:
  *
@@ -134,7 +134,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
     if( p_input->stream.pp_programs == NULL )
     {
         intf_ErrMsg( "Unable to realloc memory in input_AddProgram" );
-        return NULL;
+        return( NULL );
     }
     
     /* Allocate the structure to store this description */
@@ -143,7 +143,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
     if( p_input->stream.pp_programs[i_pgrm_index] == NULL )
     {
         intf_ErrMsg( "Unable to allocate memory in input_AddProgram" );
-        return NULL;
+        return( NULL );
     }
     
     /* Init this entry */
@@ -174,7 +174,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
         if( p_input->stream.pp_programs[i_pgrm_index]->p_demux_data == NULL )
         {
             intf_ErrMsg( "Unable to allocate memory in input_AddProgram" );
-            return NULL;
+            return( NULL );
         }
         memset( p_input->stream.pp_programs[i_pgrm_index]->p_demux_data, 0,
                 i_data_len );
@@ -272,7 +272,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
     if( p_es == NULL )
     {
         intf_ErrMsg( "Unable to allocate memory in input_AddES" );
-        return NULL;
+        return( NULL);
     }
     p_input->stream.i_es_number++;
     p_input->stream.pp_es = realloc( p_input->stream.pp_es,
@@ -281,7 +281,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
     if( p_input->stream.pp_es == NULL )
     {
         intf_ErrMsg( "Unable to realloc memory in input_AddES" );
-        return NULL;
+        return( NULL );
     }
     p_input->stream.pp_es[p_input->stream.i_es_number - 1] = p_es;
     p_es->i_id = i_es_id;
@@ -297,7 +297,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
         if( p_es->p_demux_data == NULL )
         {
             intf_ErrMsg( "Unable to allocate memory in input_AddES" );
-            return NULL;
+            return( NULL );
         }
         memset( p_es->p_demux_data, 0, i_data_len );
     }
@@ -316,7 +316,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
         if( p_pgrm->pp_es == NULL )
         {
             intf_ErrMsg( "Unable to realloc memory in input_AddES" );
-            return NULL;
+            return( NULL );
         }
         p_pgrm->pp_es[p_pgrm->i_es_number - 1] = p_es;
         p_es->p_pgrm = p_pgrm;
@@ -477,16 +477,17 @@ static vdec_config_t * GetVdecConfig( input_thread_t * p_input,
 {
     vdec_config_t *     p_config;
 
-    if( (p_config = (vdec_config_t *)malloc( sizeof(vdec_config_t) )) == NULL)
+    p_config = (vdec_config_t *)malloc( sizeof(vdec_config_t) );
+    if( p_config == NULL )
     {
         intf_ErrMsg( "Unable to allocate memory in GetVdecConfig" );
-        return NULL;
+        return( NULL );
     }
     p_config->p_vout = p_input->p_default_vout;
     if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 )
     {
         free( p_config );
-        return NULL;
+        return( NULL );
     }
 
     return( p_config );
@@ -500,16 +501,17 @@ static adec_config_t * GetAdecConfig( input_thread_t * p_input,
 {
     adec_config_t *     p_config;
 
-    if ( (p_config = (adec_config_t *)malloc( sizeof(adec_config_t))) ==NULL )
+    p_config = (adec_config_t *)malloc( sizeof(adec_config_t));
+    if( p_config == NULL )
     {
         intf_ErrMsg( "Unable to allocate memory in GetAdecConfig" );
-        return NULL;
+        return( NULL );
     }
     p_config->p_aout = p_input->p_default_aout;
     if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 )
     {
         free( p_config );
-        return NULL;
+        return( NULL );
     }
 
     return( p_config );
index ee771fe6af73a864f43881a8a2e63a20e7c364a2..fff8bbd4b76b0c3dc7683659310e5146252b81bc 100644 (file)
@@ -174,7 +174,7 @@ void module_DestroyBank( module_bank_t * p_bank )
         }
     }
 
-    /* Destory the lock */
+    /* Destroy the lock */
     vlc_mutex_destroy( &p_bank->lock );
     
     /* We can free the module bank */
index 46d985e00a0f2da36490e805ede7d61de855d85c..a441ead96bcc25f7c146875c758fcccb046de11f 100644 (file)
@@ -730,29 +730,29 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
  *****************************************************************************/
 void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-   vlc_mutex_lock( &p_vout->picture_lock );
+    vlc_mutex_lock( &p_vout->picture_lock );
 
 #ifdef DEBUG
-   /* Check if picture status is valid */
-   if( (p_pic->i_status != RESERVED_PICTURE) &&
-       (p_pic->i_status != RESERVED_DATED_PICTURE) &&
-       (p_pic->i_status != RESERVED_DISP_PICTURE) )
-   {
-       intf_DbgMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status );
-   }
+    /* Check if picture status is valid */
+    if( (p_pic->i_status != RESERVED_PICTURE) &&
+        (p_pic->i_status != RESERVED_DATED_PICTURE) &&
+        (p_pic->i_status != RESERVED_DISP_PICTURE) )
+    {
+        intf_DbgMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status );
+    }
 #endif
 
-   p_pic->i_status = DESTROYED_PICTURE;
-   p_vout->i_pictures--;
+    p_pic->i_status = DESTROYED_PICTURE;
+    p_vout->i_pictures--;
 
 #ifdef DEBUG_VOUT
-   intf_DbgMsg("picture %p", p_pic);
+    intf_DbgMsg("picture %p", p_pic);
 #endif
 
-   /* destroy the lock that had been initialized in CreatePicture */
-   vlc_mutex_destroy( &(p_pic->lock_deccount) );
+    /* destroy the lock that had been initialized in CreatePicture */
+    vlc_mutex_destroy( &(p_pic->lock_deccount) );
    
-   vlc_mutex_unlock( &p_vout->picture_lock );
+    vlc_mutex_unlock( &p_vout->picture_lock );
 }
 
 /*****************************************************************************
index 1d2212f7159c0dda81ca0a10c9b1867cce32b3ff..bb2a58e420b28f407343d8bdcdafdd416e57f537 100644 (file)
@@ -2,7 +2,7 @@
  * video_parser.c : video parser thread
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_parser.c,v 1.62 2001/01/07 03:56:40 henri Exp $
+ * $Id: video_parser.c,v 1.63 2001/01/07 04:31:18 henri Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -387,9 +387,9 @@ static void EndThread( vpar_thread_t *p_vpar )
 
 #ifdef VDEC_SMP
     /* Destroy lock and cond */
-    vlc_mutex_destroy( &(p_vpar->vfifo.lock) );
     vlc_mutex_destroy( &(p_vpar->vbuffer.lock) );
     vlc_cond_destroy( &(p_vpar->vfifo.wait) );
+    vlc_mutex_destroy( &(p_vpar->vfifo.lock) );
 #endif
     
     vlc_mutex_destroy( &(p_vpar->synchro.fifo_lock) );