Commit a5d3d165 authored by Henri Fallon's avatar Henri Fallon

- Order : if a then b are initialized, release b then a ;
- Typos ;
- Cosmetic changes.
parent 393a5d52
...@@ -152,7 +152,10 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, ...@@ -152,7 +152,10 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
char *psz_name, vlc_thread_func_t func, char *psz_name, vlc_thread_func_t func,
void *p_data) 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 ); *p_thread = cthread_fork( (cthread_fn_t)func, (any_t)p_data );
return 0; return 0;
...@@ -161,9 +164,6 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, ...@@ -161,9 +164,6 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
B_NORMAL_PRIORITY, p_data ); B_NORMAL_PRIORITY, p_data );
return resume_thread( *p_thread ); return resume_thread( *p_thread );
#elif defined(HAVE_PTHREAD_H)
return pthread_create( p_thread, NULL, func, p_data );
#endif #endif
} }
...@@ -281,7 +281,7 @@ static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex ) ...@@ -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 ) 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 ...@@ -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 ) static __inline__ int vlc_cond_destroy( vlc_cond_t *p_condvar )
{ {
......
...@@ -355,12 +355,12 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status ) ...@@ -355,12 +355,12 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
free( p_aout->s32_buffer ); free( p_aout->s32_buffer );
/* Destroy the condition and mutex locks */ /* Destroy the condition and mutex locks */
vlc_mutex_destroy( &p_aout->fifos_lock );
for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ ) for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
{ {
vlc_mutex_destroy( &p_aout->fifo[i_fifo].data_lock ); vlc_mutex_destroy( &p_aout->fifo[i_fifo].data_lock );
vlc_cond_destroy( &p_aout->fifo[i_fifo].data_wait ); vlc_cond_destroy( &p_aout->fifo[i_fifo].data_wait );
} }
vlc_mutex_destroy( &p_aout->fifos_lock );
/* Free the structure */ /* Free the structure */
p_aout->p_sys_close( p_aout ); p_aout->p_sys_close( p_aout );
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * 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: * Authors:
* *
...@@ -319,8 +319,8 @@ static void EndThread( input_thread_t * p_input ) ...@@ -319,8 +319,8 @@ static void EndThread( input_thread_t * p_input )
free( p_input->p_plugin ); free( p_input->p_plugin );
/* Destroy Mutex locks */ /* 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.control.control_lock );
vlc_mutex_destroy( &p_input->stream.stream_lock );
/* Free input structure */ /* Free input structure */
free( p_input ); free( p_input );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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: * Authors:
* *
...@@ -134,7 +134,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, ...@@ -134,7 +134,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
if( p_input->stream.pp_programs == NULL ) if( p_input->stream.pp_programs == NULL )
{ {
intf_ErrMsg( "Unable to realloc memory in input_AddProgram" ); intf_ErrMsg( "Unable to realloc memory in input_AddProgram" );
return NULL; return( NULL );
} }
/* Allocate the structure to store this description */ /* Allocate the structure to store this description */
...@@ -143,7 +143,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, ...@@ -143,7 +143,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input,
if( p_input->stream.pp_programs[i_pgrm_index] == NULL ) if( p_input->stream.pp_programs[i_pgrm_index] == NULL )
{ {
intf_ErrMsg( "Unable to allocate memory in input_AddProgram" ); intf_ErrMsg( "Unable to allocate memory in input_AddProgram" );
return NULL; return( NULL );
} }
/* Init this entry */ /* Init this entry */
...@@ -174,7 +174,7 @@ pgrm_descriptor_t * input_AddProgram( input_thread_t * p_input, ...@@ -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 ) if( p_input->stream.pp_programs[i_pgrm_index]->p_demux_data == NULL )
{ {
intf_ErrMsg( "Unable to allocate memory in input_AddProgram" ); 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, memset( p_input->stream.pp_programs[i_pgrm_index]->p_demux_data, 0,
i_data_len ); i_data_len );
...@@ -272,7 +272,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -272,7 +272,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
if( p_es == NULL ) if( p_es == NULL )
{ {
intf_ErrMsg( "Unable to allocate memory in input_AddES" ); intf_ErrMsg( "Unable to allocate memory in input_AddES" );
return NULL; return( NULL);
} }
p_input->stream.i_es_number++; p_input->stream.i_es_number++;
p_input->stream.pp_es = realloc( p_input->stream.pp_es, 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, ...@@ -281,7 +281,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
if( p_input->stream.pp_es == NULL ) if( p_input->stream.pp_es == NULL )
{ {
intf_ErrMsg( "Unable to realloc memory in input_AddES" ); 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_input->stream.pp_es[p_input->stream.i_es_number - 1] = p_es;
p_es->i_id = i_es_id; p_es->i_id = i_es_id;
...@@ -297,7 +297,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -297,7 +297,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
if( p_es->p_demux_data == NULL ) if( p_es->p_demux_data == NULL )
{ {
intf_ErrMsg( "Unable to allocate memory in input_AddES" ); intf_ErrMsg( "Unable to allocate memory in input_AddES" );
return NULL; return( NULL );
} }
memset( p_es->p_demux_data, 0, i_data_len ); memset( p_es->p_demux_data, 0, i_data_len );
} }
...@@ -316,7 +316,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, ...@@ -316,7 +316,7 @@ es_descriptor_t * input_AddES( input_thread_t * p_input,
if( p_pgrm->pp_es == NULL ) if( p_pgrm->pp_es == NULL )
{ {
intf_ErrMsg( "Unable to realloc memory in input_AddES" ); 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_pgrm->pp_es[p_pgrm->i_es_number - 1] = p_es;
p_es->p_pgrm = p_pgrm; p_es->p_pgrm = p_pgrm;
...@@ -477,16 +477,17 @@ static vdec_config_t * GetVdecConfig( input_thread_t * p_input, ...@@ -477,16 +477,17 @@ static vdec_config_t * GetVdecConfig( input_thread_t * p_input,
{ {
vdec_config_t * p_config; 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" ); intf_ErrMsg( "Unable to allocate memory in GetVdecConfig" );
return NULL; return( NULL );
} }
p_config->p_vout = p_input->p_default_vout; p_config->p_vout = p_input->p_default_vout;
if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 ) if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 )
{ {
free( p_config ); free( p_config );
return NULL; return( NULL );
} }
return( p_config ); return( p_config );
...@@ -500,16 +501,17 @@ static adec_config_t * GetAdecConfig( input_thread_t * p_input, ...@@ -500,16 +501,17 @@ static adec_config_t * GetAdecConfig( input_thread_t * p_input,
{ {
adec_config_t * p_config; 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" ); intf_ErrMsg( "Unable to allocate memory in GetAdecConfig" );
return NULL; return( NULL );
} }
p_config->p_aout = p_input->p_default_aout; p_config->p_aout = p_input->p_default_aout;
if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 ) if( InitDecConfig( p_input, p_es, &p_config->decoder_config ) == -1 )
{ {
free( p_config ); free( p_config );
return NULL; return( NULL );
} }
return( p_config ); return( p_config );
......
...@@ -174,7 +174,7 @@ void module_DestroyBank( module_bank_t * p_bank ) ...@@ -174,7 +174,7 @@ void module_DestroyBank( module_bank_t * p_bank )
} }
} }
/* Destory the lock */ /* Destroy the lock */
vlc_mutex_destroy( &p_bank->lock ); vlc_mutex_destroy( &p_bank->lock );
/* We can free the module bank */ /* We can free the module bank */
......
...@@ -730,29 +730,29 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type, ...@@ -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 ) 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 #ifdef DEBUG
/* Check if picture status is valid */ /* Check if picture status is valid */
if( (p_pic->i_status != RESERVED_PICTURE) && if( (p_pic->i_status != RESERVED_PICTURE) &&
(p_pic->i_status != RESERVED_DATED_PICTURE) && (p_pic->i_status != RESERVED_DATED_PICTURE) &&
(p_pic->i_status != RESERVED_DISP_PICTURE) ) (p_pic->i_status != RESERVED_DISP_PICTURE) )
{ {
intf_DbgMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status ); intf_DbgMsg("error: picture %p has invalid status %d", p_pic, p_pic->i_status );
} }
#endif #endif
p_pic->i_status = DESTROYED_PICTURE; p_pic->i_status = DESTROYED_PICTURE;
p_vout->i_pictures--; p_vout->i_pictures--;
#ifdef DEBUG_VOUT #ifdef DEBUG_VOUT
intf_DbgMsg("picture %p", p_pic); intf_DbgMsg("picture %p", p_pic);
#endif #endif
/* destroy the lock that had been initialized in CreatePicture */ /* destroy the lock that had been initialized in CreatePicture */
vlc_mutex_destroy( &(p_pic->lock_deccount) ); vlc_mutex_destroy( &(p_pic->lock_deccount) );
vlc_mutex_unlock( &p_vout->picture_lock ); vlc_mutex_unlock( &p_vout->picture_lock );
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_parser.c : video parser thread * video_parser.c : video parser thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr> * Samuel Hocevar <sam@via.ecp.fr>
...@@ -387,9 +387,9 @@ static void EndThread( vpar_thread_t *p_vpar ) ...@@ -387,9 +387,9 @@ static void EndThread( vpar_thread_t *p_vpar )
#ifdef VDEC_SMP #ifdef VDEC_SMP
/* Destroy lock and cond */ /* Destroy lock and cond */
vlc_mutex_destroy( &(p_vpar->vfifo.lock) );
vlc_mutex_destroy( &(p_vpar->vbuffer.lock) ); vlc_mutex_destroy( &(p_vpar->vbuffer.lock) );
vlc_cond_destroy( &(p_vpar->vfifo.wait) ); vlc_cond_destroy( &(p_vpar->vfifo.wait) );
vlc_mutex_destroy( &(p_vpar->vfifo.lock) );
#endif #endif
vlc_mutex_destroy( &(p_vpar->synchro.fifo_lock) ); vlc_mutex_destroy( &(p_vpar->synchro.fifo_lock) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment