From b4b0a1b6f82807f4e7b0a1f96b62dcf109018549 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Sat, 15 Mar 2008 20:01:04 +0100 Subject: [PATCH] Remove useless test before free and delete. --- modules/gui/macosx/bookmarks.m | 3 +-- modules/gui/pda/pda_callbacks.c | 4 ++-- modules/gui/skins2/src/ft2_font.cpp | 5 +---- modules/gui/skins2/src/skin_main.cpp | 5 +---- modules/gui/skins2/unzip/unzip.c | 2 +- modules/gui/wince/dialogs.cpp | 10 +++++----- modules/gui/wxwidgets/dialogs.cpp | 22 +++++++++++----------- modules/gui/wxwidgets/dialogs/open.cpp | 6 +++--- modules/gui/wxwidgets/dialogs/playlist.cpp | 3 +-- modules/gui/wxwidgets/extrapanel.cpp | 2 +- modules/misc/notify/xosd.c | 7 ++----- modules/misc/screensaver.c | 7 ++----- modules/misc/svg.c | 3 +-- modules/stream_out/duplicate.c | 15 +++------------ modules/stream_out/mosaic_bridge.c | 6 ++---- 15 files changed, 37 insertions(+), 63 deletions(-) diff --git a/modules/gui/macosx/bookmarks.m b/modules/gui/macosx/bookmarks.m index 4a2c15c994..69df666e43 100644 --- a/modules/gui/macosx/bookmarks.m +++ b/modules/gui/macosx/bookmarks.m @@ -249,8 +249,7 @@ static VLCBookmarks *_o_sharedInstance = nil; i = [o_tbl_dataTable selectedRow]; - if( pp_bookmarks[i]->psz_name ) - free( pp_bookmarks[i]->psz_name ); + free( pp_bookmarks[i]->psz_name ); pp_bookmarks[i]->psz_name = strdup([[o_edit_fld_name stringValue] UTF8String]); pp_bookmarks[i]->i_byte_offset = [[o_edit_fld_bytes stringValue] intValue]; diff --git a/modules/gui/pda/pda_callbacks.c b/modules/gui/pda/pda_callbacks.c index 1685c58411..0ba2b4aca5 100644 --- a/modules/gui/pda/pda_callbacks.c +++ b/modules/gui/pda/pda_callbacks.c @@ -231,7 +231,7 @@ void ReadDirectory(intf_thread_t *p_intf, GtkListStore *p_list, char *psz_dir ) 4, ppsz_text[3], -1); - if (ppsz_text[1]) free(ppsz_text[1]); + free(ppsz_text[1]); } /* kludge */ for (i=0; igetOSLoop(); diff --git a/modules/gui/skins2/unzip/unzip.c b/modules/gui/skins2/unzip/unzip.c index f9efb750e8..cdb2efd531 100644 --- a/modules/gui/skins2/unzip/unzip.c +++ b/modules/gui/skins2/unzip/unzip.c @@ -75,7 +75,7 @@ woven in by Terry Thorsen 1/2003. # define ALLOC(size) (malloc(size)) #endif #ifndef TRYFREE -# define TRYFREE(p) {if (p) free(p);} +# define TRYFREE(p) {free(p);} #endif #define SIZECENTRALDIRITEM (0x2e) diff --git a/modules/gui/wince/dialogs.cpp b/modules/gui/wince/dialogs.cpp index 83ba42d442..ac7027b30a 100644 --- a/modules/gui/wince/dialogs.cpp +++ b/modules/gui/wince/dialogs.cpp @@ -118,11 +118,11 @@ DialogsProvider::DialogsProvider( intf_thread_t *p_intf, DialogsProvider::~DialogsProvider() { /* Clean up */ - if( p_open_dialog ) delete p_open_dialog; - if( p_playlist_dialog ) delete p_playlist_dialog; - if( p_messages_dialog ) delete p_messages_dialog; - if( p_fileinfo_dialog ) delete p_fileinfo_dialog; - if( p_prefs_dialog ) delete p_prefs_dialog; + delete p_open_dialog; + delete p_playlist_dialog; + delete p_messages_dialog; + delete p_fileinfo_dialog; + delete p_prefs_dialog; if( h_gsgetfile_dll ) FreeLibrary( h_gsgetfile_dll ); } diff --git a/modules/gui/wxwidgets/dialogs.cpp b/modules/gui/wxwidgets/dialogs.cpp index b62632be84..3b58e794eb 100644 --- a/modules/gui/wxwidgets/dialogs.cpp +++ b/modules/gui/wxwidgets/dialogs.cpp @@ -264,22 +264,22 @@ DialogsProvider::~DialogsProvider() PopEventHandler(true); /* Clean up */ - if( p_open_dialog ) delete p_open_dialog; + delete p_open_dialog; if( p_prefs_dialog ) p_prefs_dialog->Destroy(); - if( p_file_dialog ) delete p_file_dialog; - if( p_playlist_dialog ) delete p_playlist_dialog; - if( p_messages_dialog ) delete p_messages_dialog; - if( p_fileinfo_dialog ) delete p_fileinfo_dialog; - if( p_file_generic_dialog ) delete p_file_generic_dialog; - if( p_wizard_dialog ) delete p_wizard_dialog; - if( p_bookmarks_dialog ) delete p_bookmarks_dialog; + delete p_file_dialog; + delete p_playlist_dialog; + delete p_messages_dialog; + delete p_fileinfo_dialog; + delete p_file_generic_dialog; + delete p_wizard_dialog; + delete p_bookmarks_dialog; #ifdef UPDATE_CHECK - if( p_updatevlc_dialog ) delete p_updatevlc_dialog; + delete p_updatevlc_dialog; #endif - //if( p_vlm_dialog ) delete p_vlm_dialog; + //delete p_vlm_dialog; - if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon; + delete p_intf->p_sys->p_icon; /* We must set this here because on win32 this destructor will be * automatically called so we must not call it again on wxApp->OnExit(). diff --git a/modules/gui/wxwidgets/dialogs/open.cpp b/modules/gui/wxwidgets/dialogs/open.cpp index df988e4a8c..e487eecebd 100644 --- a/modules/gui/wxwidgets/dialogs/open.cpp +++ b/modules/gui/wxwidgets/dialogs/open.cpp @@ -588,9 +588,9 @@ OpenDialog::OpenDialog( intf_thread_t *_p_intf, wxWindow *_p_parent, OpenDialog::~OpenDialog() { /* Clean up */ - if( file_dialog ) delete file_dialog; - if( sout_dialog ) delete sout_dialog; - if( subsfile_dialog ) delete subsfile_dialog; + delete file_dialog; + delete sout_dialog; + delete subsfile_dialog; } int OpenDialog::Show( int i_access_method, int i_arg ) diff --git a/modules/gui/wxwidgets/dialogs/playlist.cpp b/modules/gui/wxwidgets/dialogs/playlist.cpp index bc63d436fd..b1fe2476f4 100644 --- a/modules/gui/wxwidgets/dialogs/playlist.cpp +++ b/modules/gui/wxwidgets/dialogs/playlist.cpp @@ -539,8 +539,7 @@ void Playlist::UpdateTreeItem( wxTreeItemId item ) msg = wxString(wxU( psz_artist )) + wxT(" - ") + wxString(wxU(psz_name)) + duration; } - if( psz_artist ) - free( psz_artist ); + free( psz_artist ); free( psz_name ); treectrl->SetItemText( item , msg ); treectrl->SetItemImage( item, p_item->p_input->i_type ); diff --git a/modules/gui/wxwidgets/extrapanel.cpp b/modules/gui/wxwidgets/extrapanel.cpp index 77f9b1eedb..f7bcfd6fc0 100644 --- a/modules/gui/wxwidgets/extrapanel.cpp +++ b/modules/gui/wxwidgets/extrapanel.cpp @@ -357,7 +357,7 @@ wxPanel *ExtraPanel::VideoPanel( wxWindow *parent ) hue_slider->Disable(); gamma_slider->Disable(); } - if( psz_filters ) free( psz_filters ); + free( psz_filters ); int i_value = config_GetInt( p_intf, "hue" ); if( i_value > 0 && i_value < 360 ) diff --git a/modules/misc/notify/xosd.c b/modules/misc/notify/xosd.c index bf5ad459e1..803ab53b1d 100644 --- a/modules/misc/notify/xosd.c +++ b/modules/misc/notify/xosd.c @@ -222,11 +222,8 @@ static void Run( intf_thread_t *p_intf ) vlc_object_release( p_playlist ); continue; } - if( psz_display ) - { - free( psz_display ); - psz_display = NULL; - } + free( psz_display ); + psz_display = NULL; if( p_playlist->status.i_status == PLAYLIST_STOPPED ) { psz_display = strdup(_("Stop")); diff --git a/modules/misc/screensaver.c b/modules/misc/screensaver.c index 80c42ffa26..c090831428 100644 --- a/modules/misc/screensaver.c +++ b/modules/misc/screensaver.c @@ -129,11 +129,8 @@ static void Deactivate( vlc_object_t *p_this ) # endif } - if( p_intf->p_sys ) - { - free( p_intf->p_sys ); - p_intf->p_sys = NULL; - } + free( p_intf->p_sys ); + p_intf->p_sys = NULL; #endif } diff --git a/modules/misc/svg.c b/modules/misc/svg.c index 7669dc5e13..9398c8c495 100644 --- a/modules/misc/svg.c +++ b/modules/misc/svg.c @@ -507,8 +507,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, static void FreeString( svg_rendition_t *p_svg ) { - if( p_svg->psz_text ) - free( p_svg->psz_text ); + free( p_svg->psz_text ); /* p_svg->p_rendition is a GdkPixbuf, and its allocation is managed through ref. counting */ if( p_svg->p_rendition ) diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c index 3ac8335c67..d923f9efa3 100644 --- a/modules/stream_out/duplicate.c +++ b/modules/stream_out/duplicate.c @@ -150,19 +150,10 @@ static void Close( vlc_object_t * p_this ) for( i = 0; i < p_sys->i_nb_streams; i++ ) { sout_StreamDelete( p_sys->pp_streams[i] ); - if( p_sys->ppsz_select[i] ) - { - free( p_sys->ppsz_select[i] ); - } - } - if( p_sys->pp_streams ) - { - free( p_sys->pp_streams ); - } - if( p_sys->ppsz_select ) - { - free( p_sys->ppsz_select ); + free( p_sys->ppsz_select[i] ); } + free( p_sys->pp_streams ); + free( p_sys->ppsz_select ); free( p_sys ); } diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c index 7ed0f171c5..d9790bc786 100644 --- a/modules/stream_out/mosaic_bridge.c +++ b/modules/stream_out/mosaic_bridge.c @@ -456,8 +456,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_t *id ) { if ( pp_ring[i] != NULL ) { - if ( pp_ring[i]->p_data_orig != NULL ) - free( pp_ring[i]->p_data_orig ); + free( pp_ring[i]->p_data_orig ); free( pp_ring[i]->p_sys ); free( pp_ring[i] ); } @@ -744,8 +743,7 @@ static picture_t *video_new_buffer( vlc_object_t *p_this, { if ( pp_ring[i]->i_status == DESTROYED_PICTURE ) { - if ( pp_ring[i]->p_data_orig != NULL ) - free( pp_ring[i]->p_data_orig ); + free( pp_ring[i]->p_data_orig ); free( pp_ring[i]->p_sys ); free( pp_ring[i] ); } -- 2.39.2