]> git.sesse.net Git - vlc/commitdiff
cosmetic: remove nullity test on free() and delete
authorAnthony Loiseau <thannoy@actech-innovation.com>
Thu, 16 Jul 2009 13:00:00 +0000 (15:00 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Thu, 16 Jul 2009 16:13:18 +0000 (18:13 +0200)
Signed-off-by: Rémi Duraffort <ivoire@videolan.org>
25 files changed:
modules/access/cdda/info.c
modules/codec/realvideo.c
modules/codec/wmafixed/wma.c
modules/control/http/rpn.c
modules/demux/mkv/matroska_segment_parse.cpp
modules/gui/qt4/menus.cpp
modules/gui/skins2/commands/async_queue.cpp
modules/gui/skins2/macosx/macosx_loop.cpp
modules/gui/skins2/parser/interpreter.cpp
modules/gui/skins2/src/dialogs.cpp
modules/gui/skins2/src/logger.cpp
modules/gui/skins2/src/os_factory.cpp
modules/gui/skins2/src/theme_repository.cpp
modules/gui/skins2/src/var_manager.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vout_manager.cpp
modules/gui/skins2/win32/win32_loop.cpp
modules/gui/skins2/x11/x11_loop.cpp
modules/packetizer/dirac.c
modules/video_filter/atmo/AtmoConfig.cpp
modules/video_filter/atmo/AtmoExternalCaptureInput.cpp
modules/video_filter/atmo/atmo.cpp
modules/video_filter/opencv_example.cpp
modules/video_output/qte/qte.cpp
modules/video_output/x11/xvmc.c

index b0de8285b6caadf5ab00dc43080eb408c684dd46..85ddf1d40f61ed781b6c0be047b381cd989e2105 100644 (file)
@@ -48,8 +48,8 @@ static char *CDDAFormatMRL( const access_t *p_access, track_t i_track );
 #ifdef HAVE_LIBCDDB
 
 #define free_and_dup(var, val) \
-  if (var) free(var);          \
-  if (val) var=strdup(val);
+  free( var );          \
+  if (val) var = strdup( val );
 
 
 /* Saves CDDB information about CD-DA via libcddb. */
index 5ac53bf875705741ad8cb0e7f02ecd904a69741f..25da2fc42cc2be0c6822352104885cf66b395818 100644 (file)
@@ -222,7 +222,7 @@ static int InitVideo(decoder_t *p_dec)
             free( p_sys );
             return VLC_EGENERIC;
     }
-    if (p_sys->plane) free(p_sys->plane);
+    free( p_sys->plane );
     p_sys->plane = malloc (p_dec->fmt_in.video.i_width*p_dec->fmt_in.video.i_height*3/2 + 1024 );
     if (NULL == p_sys->plane)
     {
@@ -419,11 +419,8 @@ static void Close( vlc_object_t *p_this )
 #endif
         p_sys->rv_handle=NULL;
 
-    if (p_sys->plane)
-    {
-        free(p_sys->plane);
-        p_sys->plane = NULL;
-    }
+    free( p_sys->plane );
+    p_sys->plane = NULL;
 
     msg_Dbg( p_dec, "FreeLibrary ok." );
 #ifdef LOADER
index a67e6eb8bcdbab29238f9a2dddc965b5c112f1ba..e20309ecceb21b685980dc74eb8f6acbe5f15557 100644 (file)
@@ -261,8 +261,7 @@ static aout_buffer_t *DecodeFrame( decoder_t *p_dec, block_t **pp_block )
 
     /* worst case */
     size_t i_buffer = BLOCK_MAX_SIZE * MAX_CHANNELS * p_sys->wmadec.nb_frames;
-    if( p_sys->p_output )
-        free( p_sys->p_output );
+    free( p_sys->p_output );
     p_sys->p_output = malloc(i_buffer * sizeof(int32_t) );
     p_sys->p_samples = (int8_t*)p_sys->p_output;
 
index a0a7284b5579dca49794ea0520c8255ca8d805bd..ce89c7ec263a5b67d17572f6a317703ff8266ab1 100644 (file)
@@ -641,8 +641,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t  *vars,
 
                 if( !b_error )
                     var_Set( p_object, psz_variable, val );
-                if( psz_value != NULL )
-                    free( psz_value );
+                free( psz_value );
             }
             else
                 msg_Warn( p_intf, "vlc_var_set called without an object" );
@@ -811,8 +810,7 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t  *vars,
             }
             i_result = config_SaveConfigFile( p_intf, psz_module );
 
-            if( psz_module != NULL )
-                free( psz_module );
+            free( psz_module );
             SSPushN( st, i_result );
         }
         else if( !strcmp( s, "vlc_config_reset" ) )
index 33fffa5023799f8dc33774c9cb31935f51f37086..5ea638e59479675bc4fdc58267195570c232392a 100644 (file)
@@ -306,8 +306,7 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
         {
             KaxTrackLanguage &lang = *(KaxTrackLanguage*)l;
 
-            if ( tk->fmt.psz_language != NULL )
-                free( tk->fmt.psz_language );
+            free( tk->fmt.psz_language );
             tk->fmt.psz_language = strdup( string( lang ).c_str() );
             msg_Dbg( &sys.demuxer,
                      "|   |   |   + Track Language=`%s'", tk->fmt.psz_language );
index 599263efda4264e360e923e42c22be3df0dda339..f47a270048122f91fed2ba17dc876428d6b16fcf 100644 (file)
@@ -893,8 +893,7 @@ void QVLCMenu::MiscPopupMenu( intf_thread_t *p_intf )
 void QVLCMenu::PopupMenu( intf_thread_t *p_intf, bool show )
 {
     /* Delete old popup if there is one */
-    if( p_intf->p_sys->p_popup_menu )
-        delete p_intf->p_sys->p_popup_menu;
+    delete p_intf->p_sys->p_popup_menu;
 
     if( !show )
     {
index de19dc7b3710fbb4921a1a8bd0cefac36021e98b..e2fcbac35d928d18dd6e7f18c6cedd105b9d1465 100644 (file)
@@ -67,11 +67,8 @@ AsyncQueue *AsyncQueue::instance( intf_thread_t *pIntf )
 
 void AsyncQueue::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_queue )
-    {
-        delete pIntf->p_sys->p_queue;
-        pIntf->p_sys->p_queue = NULL;
-    }
+    delete pIntf->p_sys->p_queue;
+    pIntf->p_sys->p_queue = NULL;
 }
 
 
index f36bad33411366079b7b561fdd24c27d60245f64..ab46ae913c9e329127a90026ed7f4098a7620cc3 100644 (file)
@@ -72,11 +72,8 @@ OSLoop *MacOSXLoop::instance( intf_thread_t *pIntf )
 
 void MacOSXLoop::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_osLoop )
-    {
-        delete pIntf->p_sys->p_osLoop;
-        pIntf->p_sys->p_osLoop = NULL;
-    }
+    delete pIntf->p_sys->p_osLoop;
+    pIntf->p_sys->p_osLoop = NULL;
 }
 
 
index 5f3ae2223c8a052468184be2a5b2a829ebc1858a..56c9f11a85eac6da4b17f7f3ba69ffe4af1eeea5 100644 (file)
@@ -141,11 +141,8 @@ Interpreter *Interpreter::instance( intf_thread_t *pIntf )
 
 void Interpreter::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_interpreter )
-    {
-        delete pIntf->p_sys->p_interpreter;
-        pIntf->p_sys->p_interpreter = NULL;
-    }
+    delete pIntf->p_sys->p_interpreter;
+    pIntf->p_sys->p_interpreter = NULL;
 }
 
 
index 98f34b8d9fcc8448dde480f77c3780547949037b..e267295c6bee88d3482c5391ae40039e9cd3ef97 100644 (file)
@@ -147,11 +147,8 @@ Dialogs *Dialogs::instance( intf_thread_t *pIntf )
 
 void Dialogs::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_dialogs )
-    {
-        delete pIntf->p_sys->p_dialogs;
-        pIntf->p_sys->p_dialogs = NULL;
-    }
+    delete pIntf->p_sys->p_dialogs;
+    pIntf->p_sys->p_dialogs = NULL;
 }
 
 
index b0b0b2210e56efbabc0429e30fc64ce762107f8d..606a4422895ccfe18721ff6eed14133cc610436b 100644 (file)
@@ -52,11 +52,8 @@ Logger *Logger::instance( intf_thread_t *pIntf )
 
 void Logger::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_logger )
-    {
-        delete pIntf->p_sys->p_logger;
-        pIntf->p_sys->p_logger = NULL;
-    }
+    delete pIntf->p_sys->p_logger;
+    pIntf->p_sys->p_logger = NULL;
 }
 
 
index c954633164e5c2dc9759dd4cf6e650879f030a41..297485c2b0fa9514f5ce58cc9675c630a5f00b42 100644 (file)
@@ -64,10 +64,7 @@ OSFactory *OSFactory::instance( intf_thread_t *pIntf )
 
 void OSFactory::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_osFactory )
-    {
-        delete pIntf->p_sys->p_osFactory;
-        pIntf->p_sys->p_osFactory = NULL;
-    }
+    delete pIntf->p_sys->p_osFactory;
+    pIntf->p_sys->p_osFactory = NULL;
 }
 
index 04fc44e8c200e9952d9f494df8dcfb7c40c92c4f..5e4819bdbd4817f46f0e0ac3cd1878a3d6fe5458 100644 (file)
@@ -49,11 +49,8 @@ ThemeRepository *ThemeRepository::instance( intf_thread_t *pIntf )
 
 void ThemeRepository::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_repository )
-    {
-        delete pIntf->p_sys->p_repository;
-        pIntf->p_sys->p_repository = NULL;
-    }
+    delete pIntf->p_sys->p_repository;
+    pIntf->p_sys->p_repository = NULL;
 }
 
 
index 91f65fef838df636287dac75f2d1fa57ac186301..053ac95026414f99f7b215e47798e26f13723e78 100644 (file)
@@ -74,11 +74,8 @@ VarManager *VarManager::instance( intf_thread_t *pIntf )
 
 void VarManager::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_varManager )
-    {
-        delete pIntf->p_sys->p_varManager;
-        pIntf->p_sys->p_varManager = NULL;
-    }
+    delete pIntf->p_sys->p_varManager;
+    pIntf->p_sys->p_varManager = NULL;
 }
 
 
index a9a8786cc6612b8b27ab2ed55006d168aef98fc4..6dc6eff2b49bf384bf959d7a58e89a3726f4336b 100644 (file)
@@ -65,11 +65,8 @@ VlcProc *VlcProc::instance( intf_thread_t *pIntf )
 
 void VlcProc::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_vlcProc )
-    {
-        delete pIntf->p_sys->p_vlcProc;
-        pIntf->p_sys->p_vlcProc = NULL;
-    }
+    delete pIntf->p_sys->p_vlcProc;
+    pIntf->p_sys->p_vlcProc = NULL;
 }
 
 
index 65d8d89e2695276db69c024ca6a273dc424e4c4f..400743187d1a7e34354bb7ce483235f96a14d2ae 100644 (file)
@@ -50,11 +50,8 @@ VoutManager *VoutManager::instance( intf_thread_t *pIntf )
 
 void VoutManager::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_voutManager )
-    {
-        delete pIntf->p_sys->p_voutManager;
-        pIntf->p_sys->p_voutManager = NULL;
-    }
+    delete pIntf->p_sys->p_voutManager;
+    pIntf->p_sys->p_voutManager = NULL;
 }
 
 
index 1ddc580b362cefec91f0c5d534cff0f7a74b3c7e..bd7fda5d70ee87d42118e5711d952dd144033abb 100644 (file)
@@ -107,11 +107,8 @@ OSLoop *Win32Loop::instance( intf_thread_t *pIntf )
 
 void Win32Loop::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_osLoop )
-    {
-        delete pIntf->p_sys->p_osLoop;
-        pIntf->p_sys->p_osLoop = NULL;
-    }
+    delete pIntf->p_sys->p_osLoop;
+    pIntf->p_sys->p_osLoop = NULL;
 }
 
 
index f9cd7779d62c89a3227bdc2527943ed9eaab9656..b7af5995b7d53b041767281fd2c5342ab688f8d4 100644 (file)
@@ -100,11 +100,8 @@ OSLoop *X11Loop::instance( intf_thread_t *pIntf, X11Display &rDisplay )
 
 void X11Loop::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_osLoop )
-    {
-        delete pIntf->p_sys->p_osLoop;
-        pIntf->p_sys->p_osLoop = NULL;
-    }
+    delete pIntf->p_sys->p_osLoop;
+    pIntf->p_sys->p_osLoop = NULL;
 }
 
 
index 39c48185a60dbddfd43e1fd153157a44e95687a3..de4812b5d959a63e98b24cdee51b8e37f4a25d6e 100644 (file)
@@ -922,8 +922,7 @@ static int dirac_InspectDataUnit( decoder_t *p_dec, block_t **pp_block, block_t
          *  - required for ogg muxing
          *  - useful for error checking
          *  - it isn't allowed to change until an eos */
-        if( p_es->p_extra )
-            free( p_es->p_extra );
+        free( p_es->p_extra );
         p_es->p_extra = calloc( 1, p_block->i_buffer + 13 );
         if( !p_es->p_extra )
         {
index 1249bebd343ff42b49ba96d81f1da9759ed4a2fd..48d4fb86abd0955214c4512f1bface01fa7249d2 100644 (file)
@@ -64,11 +64,10 @@ CAtmoConfig::CAtmoConfig()
 }
 
 CAtmoConfig::~CAtmoConfig() {
-   // and finally cleanup...
-   clearAllChannelMappings();
+    // and finally cleanup...
+    clearAllChannelMappings();
 #if !defined (WIN32)
-   if(m_devicename)
-      free(m_devicename);
+    free( m_devicename );
 #endif
 }
 
@@ -234,9 +233,8 @@ void CAtmoConfig::AddChannelAssignment(tChannelAssignment *ta) {
 }
 
 void CAtmoConfig::SetChannelAssignment(int index, tChannelAssignment *ta) {
-     if(m_ChannelAssignments[index]!=NULL)
-        delete m_ChannelAssignments[index];
-     m_ChannelAssignments[index] = ta;
+    delete m_ChannelAssignments[index];
+    m_ChannelAssignments[index] = ta;
 }
 
 CAtmoZoneDefinition *CAtmoConfig::getZoneDefinition(int zoneIndex) {
index 1d77ee87ae0deab989cfa470451a0fc84ea3ac89..26410b9eb618a6597ca57d35b6ed05a60556abcc 100644 (file)
@@ -41,9 +41,8 @@ CAtmoExternalCaptureInput::CAtmoExternalCaptureInput(CAtmoDynData *pAtmoDynData)
 
 CAtmoExternalCaptureInput::~CAtmoExternalCaptureInput(void)
 {
-   /* if there is still an unprocessed bufferpicture do kill it */
-   if(m_pCurrentFramePixels != NULL)
-      free(m_pCurrentFramePixels);
+    /* if there is still an unprocessed bufferpicture do kill it */
+    free( m_pCurrentFramePixels );
 
 #if defined(_ATMO_VLC_PLUGIN_)
     vlc_cond_destroy( &m_WakeupCond );
index aa1970229d8147e67455f70565892446e4f3ceca..9cb0edef2119b92bc2f7801c2872834a9056b23a 100644 (file)
@@ -805,8 +805,7 @@ static void AtmoCreateTransferBuffers(filter_t *p_filter,
         we need a buffer where the image is stored (only for transfer
         to the processing thread)
         */
-        if(p_sys->p_atmo_transfer_buffer)
-            free(p_sys->p_atmo_transfer_buffer);
+        free( p_sys->p_atmo_transfer_buffer );
 
         p_sys->p_atmo_transfer_buffer = (uint8_t *)malloc(bytePerPixel *
                                                           width *  height);
index 3d899e55d3e315ef063acc5e413b6e211be1d71e..445e964f5dfa5ee50fd8ea765760eb7ae4fc3c2f 100644 (file)
@@ -133,9 +133,7 @@ static void CloseFilter( vlc_object_t *p_this )
     if( p_filter->p_sys->p_storage )
         cvReleaseMemStorage( &p_filter->p_sys->p_storage );
 
-    if (NULL != p_filter->p_sys->event_info.p_region)
-        free(p_filter->p_sys->event_info.p_region);
-
+    free( p_filter->p_sys->event_info.p_region );
     free( p_sys );
 
     var_Destroy( p_filter->p_libvlc, VIDEO_FILTER_EVENT_VARIABLE);
@@ -199,11 +197,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         if (faces && (faces->total > 0))
         {
             //msg_Dbg( p_filter, "Found %d face(s)", faces->total );
-            if (NULL != p_filter->p_sys->event_info.p_region)
-            {
-                free(p_filter->p_sys->event_info.p_region);
-                p_filter->p_sys->event_info.p_region = NULL;
-            }
+            free( p_filter->p_sys->event_info.p_region );
+            p_filter->p_sys->event_info.p_region = NULL;
             if( NULL == ( p_filter->p_sys->event_info.p_region =
                   (video_filter_region_info_t *)malloc(faces->total*sizeof(video_filter_region_info_t))))
             {
index f91acd7b3eeeda38734d48da33ceae98d7012b00..b5619d57ec630f08f8a5f21d0ffc4ec033e555c5 100644 (file)
@@ -197,11 +197,8 @@ static void Close ( vlc_object_t *p_this )
     module_unneed( p_vout, p_vout->p_sys->p_qte_main );
 #endif
 
-    if( p_vout->p_sys )
-    {
-        free( p_vout->p_sys );
-        p_vout->p_sys = NULL;
-    }
+    free( p_vout->p_sys );
+    p_vout->p_sys = NULL;
 }
 
 /*****************************************************************************
index cb522ccb48964aead0a9818895231ea399706f02..8e10fcbadeb3b9e4bffbe9d61facdef5c5651313 100644 (file)
@@ -771,8 +771,7 @@ int checkXvMCCap( vout_thread_t *p_vout )
     }
     else
     {
-        if( p_vout->p_sys->xvmc_cap )
-            free( p_vout->p_sys->xvmc_cap );
+        free( p_vout->p_sys->xvmc_cap );
         p_vout->p_sys->xvmc_cap = NULL;
         msg_Err( p_vout, "use of direct XvMC context on a remote display failed"
                          " falling back to XV." );
@@ -1012,8 +1011,7 @@ void xxmc_dispose_context( vout_thread_t *p_vout )
         }
 
         msg_Dbg( p_vout, "freeing up XvMC surfaces and subpictures" );
-        if( p_vout->p_sys->xvmc_palette )
-            free( p_vout->p_sys->xvmc_palette );
+        free( p_vout->p_sys->xvmc_palette );
         dispose_xx44_palette( &p_vout->p_sys->palette );
         xxmc_xvmc_destroy_subpictures( p_vout );
         xxmc_xvmc_destroy_surfaces( p_vout );