[vlc-devel] commit: Remove useless test before a delete. ( Rémi Duraffort )

git version control git at videolan.org
Sun Mar 16 20:34:28 CET 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Mar 15 20:26:02 2008 +0100| [54c23b66191ff8c50c699b0b92bc0e1bc617924c]

Remove useless test before a delete.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=54c23b66191ff8c50c699b0b92bc0e1bc617924c
---

 modules/demux/live555.cpp                  |    2 +-
 modules/gui/beos/VideoOutput.cpp           |   12 ++++++------
 modules/gui/qt4/dialogs/interaction.cpp    |    4 ++--
 modules/gui/qt4/qt4.cpp                    |    2 +-
 modules/gui/wince/interface.cpp            |    4 ++--
 modules/gui/wince/wince.cpp                |    2 +-
 modules/gui/wxwidgets/dialogs/messages.cpp |    3 +--
 modules/gui/wxwidgets/interface.cpp        |    6 +++---
 modules/gui/wxwidgets/wxwidgets.cpp        |    2 +-
 9 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index ce52ecd..9e5035b 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -530,7 +530,7 @@ describe:
 
     psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
                                                &authenticator );
-    if( psz_options ) delete [] psz_options;
+    delete [] psz_options;
 
     p_sdp = p_sys->rtsp->describeURL( psz_url, &authenticator,
                          var_GetBool( p_demux, "rtsp-kasenna" ) );
diff --git a/modules/gui/beos/VideoOutput.cpp b/modules/gui/beos/VideoOutput.cpp
index ca6d69a..2f85328 100644
--- a/modules/gui/beos/VideoOutput.cpp
+++ b/modules/gui/beos/VideoOutput.cpp
@@ -777,20 +777,20 @@ VideoWindow::_AllocateBuffers(int width, int height, int* mode)
                 {
                     msg_Dbg( p_vout, "using single-buffered overlay" );
                     bitmap_count = 2;
-                    if( bitmap[2] ) { delete bitmap[2]; bitmap[2] = NULL; }
+                    delete bitmap[2]; bitmap[2] = NULL;
                 }
             }
             else
             {
                 msg_Dbg( p_vout, "using simple overlay" );
                 bitmap_count = 1;
-                if( bitmap[1] ) { delete bitmap[1]; bitmap[1] = NULL; }
+                delete bitmap[1]; bitmap[1] = NULL;
             }
             break;
         }
         else
         {
-            if( bitmap[0] ) { delete bitmap[0]; bitmap[0] = NULL; }
+            delete bitmap[0]; bitmap[0] = NULL;
         }
     }
 
@@ -829,9 +829,9 @@ VideoWindow::_AllocateBuffers(int width, int height, int* mode)
 void
 VideoWindow::_FreeBuffers()
 {
-    if( bitmap[0] ) { delete bitmap[0]; bitmap[0] = NULL; }
-    if( bitmap[1] ) { delete bitmap[1]; bitmap[1] = NULL; }
-    if( bitmap[2] ) { delete bitmap[2]; bitmap[2] = NULL; }
+    delete bitmap[0]; bitmap[0] = NULL;
+    delete bitmap[1]; bitmap[1] = NULL;
+    delete bitmap[2]; bitmap[2] = NULL;
     fInitStatus = B_ERROR;
 }
 
diff --git a/modules/gui/qt4/dialogs/interaction.cpp b/modules/gui/qt4/dialogs/interaction.cpp
index 60f3acc..115d871 100644
--- a/modules/gui/qt4/dialogs/interaction.cpp
+++ b/modules/gui/qt4/dialogs/interaction.cpp
@@ -197,8 +197,8 @@ void InteractionDialog::update()
 
 InteractionDialog::~InteractionDialog()
 {
-//    if( panel ) delete panel;
-    if( dialog ) delete dialog;
+//    delete panel;
+    delete dialog;
 }
 
 void InteractionDialog::defaultB()
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 8deeca2..ccfd614 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -384,7 +384,7 @@ static void Init( intf_thread_t *p_intf )
 
     /* Destroy first the main interface because it is connected to some slots
        in the MainInputManager */
-    if( p_intf->p_sys->p_mi ) delete p_intf->p_sys->p_mi;
+    delete p_intf->p_sys->p_mi;
 
     /* Destroy then other windows, because some are connected to some slots
        in the MainInputManager */
diff --git a/modules/gui/wince/interface.cpp b/modules/gui/wince/interface.cpp
index 49cd08d..174bf70 100644
--- a/modules/gui/wince/interface.cpp
+++ b/modules/gui/wince/interface.cpp
@@ -116,8 +116,8 @@ Interface::Interface( intf_thread_t *p_intf, CBaseWindow *p_parent,
 
 Interface::~Interface()
 {
-    if( timer ) delete timer;
-    if( video ) delete video;
+    delete timer;
+    delete video;
 }
 
 BOOL Interface::InitInstance()
diff --git a/modules/gui/wince/wince.cpp b/modules/gui/wince/wince.cpp
index de3d821..fce0181 100644
--- a/modules/gui/wince/wince.cpp
+++ b/modules/gui/wince/wince.cpp
@@ -273,7 +273,7 @@ static void MainLoop( intf_thread_t *p_intf )
     }
 
  end:
-    if( intf ) delete intf;
+    delete intf;
 
 #ifndef UNDER_CE
     /* Uninitialize OLE/COM */
diff --git a/modules/gui/wxwidgets/dialogs/messages.cpp b/modules/gui/wxwidgets/dialogs/messages.cpp
index 8882746..24b9643 100644
--- a/modules/gui/wxwidgets/dialogs/messages.cpp
+++ b/modules/gui/wxwidgets/dialogs/messages.cpp
@@ -102,8 +102,7 @@ Messages::Messages( intf_thread_t *_p_intf, wxWindow *p_parent ):
 Messages::~Messages()
 {
     /* Clean up */
-    if( save_log_dialog ) delete save_log_dialog;
-
+    delete save_log_dialog;
     delete info_attr;
     delete err_attr;
     delete warn_attr;
diff --git a/modules/gui/wxwidgets/interface.cpp b/modules/gui/wxwidgets/interface.cpp
index 6485c9a..8a5577f 100644
--- a/modules/gui/wxwidgets/interface.cpp
+++ b/modules/gui/wxwidgets/interface.cpp
@@ -512,19 +512,19 @@ Interface::~Interface()
 
     PopEventHandler(true);
 
-    if( video_window ) delete video_window;
+    delete video_window;
 
 /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
 #ifndef __APPLE__
 #ifdef wxHAS_TASK_BAR_ICON
-    if( p_systray ) delete p_systray;
+    delete p_systray;
 #endif
 #endif
 
     p_intf->b_interaction = VLC_FALSE;
     var_DelCallback( p_intf, "interaction", InteractCallback, this );
 
-    if( p_intf->p_sys->p_wxwindow ) delete p_intf->p_sys->p_wxwindow;
+    delete p_intf->p_sys->p_wxwindow;
 
 
     /* Clean up */
diff --git a/modules/gui/wxwidgets/wxwidgets.cpp b/modules/gui/wxwidgets/wxwidgets.cpp
index 706f456..c6752bc 100644
--- a/modules/gui/wxwidgets/wxwidgets.cpp
+++ b/modules/gui/wxwidgets/wxwidgets.cpp
@@ -418,7 +418,7 @@ int Instance::OnExit()
     if( p_intf->pf_show_dialog )
     {
          /* We need to manually clean up the dialogs class */
-         if( p_intf->p_sys->p_wxwindow ) delete p_intf->p_sys->p_wxwindow;
+         delete p_intf->p_sys->p_wxwindow;
     }
 
 #if (wxCHECK_VERSION(2,5,0))




More information about the vlc-devel mailing list