From 4ce76d3a9d6b415b55d4095c3a74f2996059dbcd Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Wed, 12 Mar 2008 11:43:57 +0100 Subject: [PATCH] Another time "Remove useless test ..." --- modules/mux/mp4.c | 6 +- modules/mux/mpeg/ts.c | 28 +++------- modules/stream_out/mosaic_bridge.c | 13 +++-- modules/stream_out/transcode.c | 90 +++++++++++++----------------- 4 files changed, 55 insertions(+), 82 deletions(-) diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c index 704bcea75d..03c7b0d30d 100644 --- a/modules/mux/mp4.c +++ b/modules/mux/mp4.c @@ -2118,11 +2118,7 @@ static void box_fix( bo_t *box ) static void box_free( bo_t *box ) { - if( box->p_buffer ) - { - free( box->p_buffer ); - } - + free( box->p_buffer ); free( box ); } diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c index 99bdcfd3e5..7849021a3d 100644 --- a/modules/mux/mpeg/ts.c +++ b/modules/mux/mpeg/ts.c @@ -558,7 +558,7 @@ static int Open( vlc_object_t *p_this ) psz = NULL; } } - if( val.psz_string != NULL) free( val.psz_string ); + free( val.psz_string ); p_sys->i_pat_version_number = rand() % 32; p_sys->pat.i_pid = 0; @@ -623,7 +623,7 @@ static int Open( vlc_object_t *p_this ) psz_sdttoken = psz_end; } } - if( val.psz_string != NULL ) free( val.psz_string ); + free( val.psz_string ); #else p_sys->b_sdt = VLC_FALSE; #endif @@ -667,7 +667,7 @@ static int Open( vlc_object_t *p_this ) for( i = 0; i < p_sys->i_num_pmt; i++ ) p_sys->i_pmt_program_number[i] = i + 1; } - if( val.psz_string != NULL ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_mux, SOUT_CFG_PREFIX "pid-pmt", &val ); if( val.i_int ) @@ -813,7 +813,7 @@ static int Open( vlc_object_t *p_this ) } } } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_mux, SOUT_CFG_PREFIX "crypt-audio", &val ); p_sys->b_crypt_audio = val.b_bool; @@ -839,15 +839,11 @@ static void Close( vlc_object_t * p_this ) } for( i = 0; i < MAX_PMT; i++ ) { - if( p_sys->sdt_descriptors[i].psz_service_name != NULL ) - free( p_sys->sdt_descriptors[i].psz_service_name ); - if( p_sys->sdt_descriptors[i].psz_provider != NULL ) - free( p_sys->sdt_descriptors[i].psz_provider ); + free( p_sys->sdt_descriptors[i].psz_service_name ); + free( p_sys->sdt_descriptors[i].psz_provider ); } - if( p_sys->dvbpmt != NULL ) /* safety */ - free ( p_sys->dvbpmt ); - + free( p_sys->dvbpmt ); free( p_sys ); } @@ -1241,14 +1237,8 @@ static int DelStream( sout_mux_t *p_mux, sout_input_t *p_input ) /* Empty all data in chain_pes */ BufferChainClean( &p_stream->chain_pes ); - if( p_stream->lang ) - { - free(p_stream->lang); - } - if( p_stream->p_decoder_specific_info ) - { - free( p_stream->p_decoder_specific_info ); - } + free(p_stream->lang); + free( p_stream->p_decoder_specific_info ); if( p_stream->i_stream_id == 0xfa || p_stream->i_stream_id == 0xfb || p_stream->i_stream_id == 0xfe ) diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c index 15ca34dfb0..7ed0f171c5 100644 --- a/modules/stream_out/mosaic_bridge.c +++ b/modules/stream_out/mosaic_bridge.c @@ -86,8 +86,11 @@ static void ReleasePicture( picture_t *p_pic ) } else { - if( p_pic && p_pic->p_data_orig ) free( p_pic->p_data_orig ); - if( p_pic ) free( p_pic ); + if( p_pic ) + { + free( p_pic->p_data_orig ); + free( p_pic ); + } } } } @@ -262,8 +265,7 @@ static void Close( vlc_object_t * p_this ) p_stream->p_sout->i_out_pace_nocontrol--; - if ( p_sys->psz_id ) - free( p_sys->psz_id ); + free( p_sys->psz_id ); free( p_sys ); } @@ -829,8 +831,7 @@ static void video_del_buffer( picture_t *p_pic ) p_pic->i_status = DESTROYED_PICTURE; if ( p_pic->p_sys->b_dead ) { - if ( p_pic->p_data_orig != NULL ) - free( p_pic->p_data_orig ); + free( p_pic->p_data_orig ); free( p_pic->p_sys ); free( p_pic ); } diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index ab067af54f..435b1465f3 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -490,9 +490,9 @@ static int Open( vlc_object_t *p_this ) char *psz_next; psz_next = config_ChainCreate( &p_sys->psz_aenc, &p_sys->p_audio_cfg, val.psz_string ); - if( psz_next ) free( psz_next ); + free( psz_next ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "acodec", &val ); p_sys->i_acodec = 0; @@ -502,7 +502,7 @@ static int Open( vlc_object_t *p_this ) memcpy( fcc, val.psz_string, __MIN( strlen( val.psz_string ), 4 ) ); p_sys->i_acodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "ab", &val ); p_sys->i_abitrate = val.i_int; @@ -545,7 +545,7 @@ static int Open( vlc_object_t *p_this ) if( (psz_parser != NULL) && (*psz_parser != '\0') ) psz_parser++; } } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); if( p_sys->i_afilters < TRANSCODE_FILTERS-1 ) { p_sys->psz_afilters[p_sys->i_afilters] = NULL; @@ -561,9 +561,9 @@ static int Open( vlc_object_t *p_this ) char *psz_next; psz_next = config_ChainCreate( &p_sys->psz_venc, &p_sys->p_video_cfg, val.psz_string ); - if( psz_next ) free( psz_next ); + free( psz_next ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "vcodec", &val ); p_sys->i_vcodec = 0; @@ -573,7 +573,7 @@ static int Open( vlc_object_t *p_this ) memcpy( fcc, val.psz_string, __MIN( strlen( val.psz_string ), 4 ) ); p_sys->i_vcodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "vb", &val ); p_sys->i_vbitrate = val.i_int; @@ -617,7 +617,7 @@ static int Open( vlc_object_t *p_this ) if( psz_parser != NULL && *psz_parser != '\0' ) psz_parser++; } } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); if( p_sys->i_vfilters < TRANSCODE_FILTERS-1 ) { p_sys->psz_vfilters[p_sys->i_vfilters] = NULL; @@ -636,9 +636,9 @@ static int Open( vlc_object_t *p_this ) psz_next = config_ChainCreate( &p_sys->psz_deinterlace, &p_sys->p_deinterlace_cfg, val.psz_string ); - if( psz_next ) free( psz_next ); + free( psz_next ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "croptop", &val ); p_sys->i_crop_top = val.i_int; @@ -677,7 +677,7 @@ static int Open( vlc_object_t *p_this ) else msg_Warn( p_stream, "bad aspect ratio %s", val.psz_string ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "threads", &val ); p_sys->i_threads = val.i_int; @@ -703,9 +703,9 @@ static int Open( vlc_object_t *p_this ) char *psz_next; psz_next = config_ChainCreate( &p_sys->psz_senc, &p_sys->p_spu_cfg, val.psz_string ); - if( psz_next ) free( psz_next ); + free( psz_next ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); var_Get( p_stream, SOUT_CFG_PREFIX "scodec", &val ); if( val.psz_string && *val.psz_string ) @@ -714,7 +714,7 @@ static int Open( vlc_object_t *p_this ) memcpy( fcc, val.psz_string, __MIN( strlen( val.psz_string ), 4 ) ); p_sys->i_scodec = VLC_FOURCC( fcc[0], fcc[1], fcc[2], fcc[3] ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); if( p_sys->i_scodec ) { @@ -732,7 +732,7 @@ static int Open( vlc_object_t *p_this ) var_Set( p_sys->p_spu, "sub-filter", val ); spu_Init( p_sys->p_spu ); } - if( val.psz_string ) free( val.psz_string ); + free( val.psz_string ); /* OSD menu transcoding parameters */ p_sys->psz_osdenc = NULL; @@ -748,7 +748,7 @@ static int Open( vlc_object_t *p_this ) psz_next = config_ChainCreate( &p_sys->psz_osdenc, &p_sys->p_osd_cfg, strdup( "dvbsub") ); - if( psz_next ) free( psz_next ); + free( psz_next ); p_sys->i_osdcodec = VLC_FOURCC('Y','U','V','P' ); @@ -761,13 +761,13 @@ static int Open( vlc_object_t *p_this ) var_Create( p_sys->p_spu, "sub-filter", VLC_VAR_STRING ); var_Set( p_sys->p_spu, "sub-filter", osd_val ); spu_Init( p_sys->p_spu ); - if( osd_val.psz_string ) free( osd_val.psz_string ); + free( osd_val.psz_string ); } else { osd_val.psz_string = strdup("osdmenu"); var_Set( p_sys->p_spu, "sub-filter", osd_val ); - if( osd_val.psz_string ) free( osd_val.psz_string ); + free( osd_val.psz_string ); } } @@ -797,76 +797,64 @@ static void Close( vlc_object_t * p_this ) while( p_sys->i_afilters ) { p_sys->i_afilters--; - if( p_sys->psz_afilters[p_sys->i_afilters] ) - free( p_sys->psz_afilters[p_sys->i_afilters] ); - if( p_sys->p_afilters_cfg[p_sys->i_afilters] ) - free( p_sys->p_afilters_cfg[p_sys->i_afilters] ); + free( p_sys->psz_afilters[p_sys->i_afilters] ); + free( p_sys->p_afilters_cfg[p_sys->i_afilters] ); } while( p_sys->p_audio_cfg != NULL ) { config_chain_t *p_next = p_sys->p_audio_cfg->p_next; - if( p_sys->p_audio_cfg->psz_name ) - free( p_sys->p_audio_cfg->psz_name ); - if( p_sys->p_audio_cfg->psz_value ) - free( p_sys->p_audio_cfg->psz_value ); + free( p_sys->p_audio_cfg->psz_name ); + free( p_sys->p_audio_cfg->psz_value ); free( p_sys->p_audio_cfg ); p_sys->p_audio_cfg = p_next; } - if( p_sys->psz_aenc ) free( p_sys->psz_aenc ); + free( p_sys->psz_aenc ); while( p_sys->i_vfilters ) { p_sys->i_vfilters--; - if( p_sys->psz_vfilters[p_sys->i_vfilters] ) - free( p_sys->psz_vfilters[p_sys->i_vfilters] ); - if( p_sys->p_vfilters_cfg[p_sys->i_vfilters] ) - free( p_sys->p_vfilters_cfg[p_sys->i_vfilters] ); + free( p_sys->psz_vfilters[p_sys->i_vfilters] ); + free( p_sys->p_vfilters_cfg[p_sys->i_vfilters] ); } while( p_sys->p_video_cfg != NULL ) { config_chain_t *p_next = p_sys->p_video_cfg->p_next; - if( p_sys->p_video_cfg->psz_name ) - free( p_sys->p_video_cfg->psz_name ); - if( p_sys->p_video_cfg->psz_value ) - free( p_sys->p_video_cfg->psz_value ); + free( p_sys->p_video_cfg->psz_name ); + free( p_sys->p_video_cfg->psz_value ); free( p_sys->p_video_cfg ); p_sys->p_video_cfg = p_next; } - if( p_sys->psz_venc ) free( p_sys->psz_venc ); + free( p_sys->psz_venc ); while( p_sys->p_deinterlace_cfg != NULL ) { config_chain_t *p_next = p_sys->p_deinterlace_cfg->p_next; - if( p_sys->p_deinterlace_cfg->psz_name ) - free( p_sys->p_deinterlace_cfg->psz_name ); - if( p_sys->p_deinterlace_cfg->psz_value ) - free( p_sys->p_deinterlace_cfg->psz_value ); + free( p_sys->p_deinterlace_cfg->psz_name ); + free( p_sys->p_deinterlace_cfg->psz_value ); free( p_sys->p_deinterlace_cfg ); p_sys->p_deinterlace_cfg = p_next; } - if( p_sys->psz_deinterlace ) free( p_sys->psz_deinterlace ); + free( p_sys->psz_deinterlace ); while( p_sys->p_spu_cfg != NULL ) { config_chain_t *p_next = p_sys->p_spu_cfg->p_next; - if( p_sys->p_spu_cfg->psz_name ) - free( p_sys->p_spu_cfg->psz_name ); - if( p_sys->p_spu_cfg->psz_value ) - free( p_sys->p_spu_cfg->psz_value ); + free( p_sys->p_spu_cfg->psz_name ); + free( p_sys->p_spu_cfg->psz_value ); free( p_sys->p_spu_cfg ); p_sys->p_spu_cfg = p_next; } - if( p_sys->psz_senc ) free( p_sys->psz_senc ); + free( p_sys->psz_senc ); if( p_sys->p_spu ) spu_Destroy( p_sys->p_spu ); @@ -874,15 +862,13 @@ static void Close( vlc_object_t * p_this ) { config_chain_t *p_next = p_sys->p_osd_cfg->p_next; - if( p_sys->p_osd_cfg->psz_name ) - free( p_sys->p_osd_cfg->psz_name ); - if( p_sys->p_osd_cfg->psz_value ) - free( p_sys->p_osd_cfg->psz_value ); + free( p_sys->p_osd_cfg->psz_name ); + free( p_sys->p_osd_cfg->psz_value ); free( p_sys->p_osd_cfg ); p_sys->p_osd_cfg = p_next; } - if( p_sys->psz_osdenc ) free( p_sys->psz_osdenc ); + free( p_sys->psz_osdenc ); vlc_object_release( p_sys ); } @@ -1608,7 +1594,7 @@ static int transcode_audio_process( sout_stream_t *p_stream, static void audio_release_buffer( aout_buffer_t *p_buffer ) { if( p_buffer && p_buffer->p_sys ) block_Release( p_buffer->p_sys ); - if( p_buffer ) free( p_buffer ); + free( p_buffer ); } static aout_buffer_t *audio_new_buffer( decoder_t *p_dec, int i_samples ) -- 2.39.2