]> git.sesse.net Git - vlc/commitdiff
Remove useless test before a free().
authorRémi Duraffort <ivoire@videolan.org>
Wed, 12 Mar 2008 10:42:46 +0000 (11:42 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Wed, 12 Mar 2008 11:07:42 +0000 (12:07 +0100)
12 files changed:
modules/video_filter/atmo/AtmoConfig.h
modules/video_filter/clone.c
modules/video_filter/gradient.c
modules/video_filter/marq.c
modules/video_filter/osdmenu.c
modules/video_filter/rss.c
modules/video_output/directfb.c
modules/video_output/ggi.c
modules/video_output/msw/directx.c
modules/video_output/msw/events.c
modules/video_output/opengl.c
modules/video_output/x11/xcommon.c

index 7d3b6d6029df3d869a86311fd770d9a129001917..52c57f3fd9e346cb5917e9b8c3f8e53f1aed05ff 100644 (file)
@@ -138,7 +138,7 @@ class CAtmoConfig {
 
 #if defined(_ATMO_VLC_PLUGIN_)
         char *getSerialDevice()               { return m_devicename; }
-        void setSerialDevice(char *newdevice) { if(m_devicename) free(m_devicename); if(newdevice) m_devicename = strdup(newdevice); else m_devicename = NULL; }
+        void setSerialDevice(char *newdevice) { free( m_devicename ); if(newdevice) m_devicename = strdup(newdevice); else m_devicename = NULL; }
 #else
         int getComport()                    { return m_Comport; }
         void setComport(int value)          { m_Comport = value; }
index c4d3319c85e4bf1330f3aa5cb25649726815a7a4..479ebc794f4697c049b080301f60775140df2ed7 100644 (file)
@@ -264,7 +264,7 @@ static int Init( vout_thread_t *p_vout )
             msg_Err( p_vout, "failed to clone %i vout threads",
                      p_vout->p_sys->i_clones );
             p_vout->p_sys->i_clones = i_vout;
-            if( psz_default_vout ) free( psz_default_vout );
+            free( psz_default_vout );
             RemoveAllVout( p_vout );
             return VLC_EGENERIC;
         }
@@ -272,7 +272,7 @@ static int Init( vout_thread_t *p_vout )
         ADD_CALLBACKS( p_vout->p_sys->pp_vout[ i_vout ], SendEvents );
     }
 
-    if( psz_default_vout ) free( psz_default_vout );
+    free( psz_default_vout );
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
     ADD_PARENT_CALLBACKS( SendEventsToChild );
index 300fb8bc556e8b6d7b5145392977715e150ce54d..604a3ac1468e9724f2343e269ec7dc471b84d284 100644 (file)
@@ -736,8 +736,8 @@ static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
         }
     }
 
-    if( p_hough ) free( p_hough );
-    if( p_smooth ) free( p_smooth );
+    free( p_hough );
+    free( p_smooth );
 }
 #undef p_pre_hough
 
index fe806e9a90141147d527d3d21c534e4d91b8a822..619c485f164a9908fbcab34ed9eb31f1055b0f3a 100644 (file)
@@ -238,8 +238,8 @@ static void DestroyFilter( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys = p_filter->p_sys;
 
-    if( p_sys->p_style ) free( p_sys->p_style );
-    if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
+    free( p_sys->p_style );
+    free( p_sys->psz_marquee );
 
     /* Delete the marquee variables */
 #define DEL_VAR(var) \
@@ -341,7 +341,7 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
 
     if( !strncmp( psz_var, "marq-marquee", 7 ) )
     {
-        if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
+        free( p_sys->psz_marquee );
         p_sys->psz_marquee = strdup( newval.psz_string );
     }
     else if ( !strncmp( psz_var, "marq-x", 6 ) )
index 45465673edda8a47d08481124c6566ce14dd1c39..c52644af1b1587f8b0f044a3089a81bffbcdd5a1 100644 (file)
@@ -281,8 +281,8 @@ error:
 
     osd_MenuDelete( p_this, p_sys->p_menu );
     p_sys->p_menu = NULL;
-    if( p_sys->psz_file ) free( p_sys->psz_file );
-    if( p_sys ) free( p_sys );
+    free( p_sys->psz_file );
+    free( p_sys );
     return VLC_EGENERIC;
 }
 
@@ -328,8 +328,8 @@ static void DestroyFilter( vlc_object_t *p_this )
 
     osd_MenuDelete( p_filter, p_sys->p_menu );
 
-    if( p_sys->psz_file ) free( p_sys->psz_file );
-    if( p_sys ) free( p_sys );
+    free( p_sys->psz_file );
+    free( p_sys );
 }
 
 /*****************************************************************************
index 7d60b26cf8a28687e4735599e5cd7235c4fe35b9..a43ceba7ca7af4af600e1e9d4a956e5ba95c6b76 100644 (file)
@@ -348,8 +348,8 @@ static void DestroyFilter( vlc_object_t *p_this )
 
     vlc_mutex_lock( &p_sys->lock );
 
-    if( p_sys->p_style ) free( p_sys->p_style );
-    if( p_sys->psz_marquee ) free( p_sys->psz_marquee );
+    free( p_sys->p_style );
+    free( p_sys->psz_marquee );
     free( p_sys->psz_urls );
     FreeRSS( p_filter );
     vlc_mutex_unlock( &p_sys->lock );
@@ -740,11 +740,8 @@ static int FetchRSS( filter_t *p_filter)
                     return 1;
 
                 case XML_READER_STARTELEM:
-                    if( psz_eltname )
-                    {
-                        free( psz_eltname );
-                        psz_eltname = NULL;
-                    }
+                    free( psz_eltname );
+                    psz_eltname = NULL;
                     psz_eltname = xml_ReaderName( p_xml_reader );
                     if( !psz_eltname )
                     {
@@ -816,18 +813,15 @@ static int FetchRSS( filter_t *p_filter)
                         }
                         else
                         {
-                            if( psz_href ) free( psz_href );
+                            free( psz_href );
                         }
-                        if( psz_rel ) free( psz_rel );
+                        free( psz_rel );
                     }
                     break;
 
                 case XML_READER_ENDELEM:
-                    if( psz_eltname )
-                    {
-                        free( psz_eltname );
-                        psz_eltname = NULL;
-                    }
+                    free( psz_eltname );
+                    psz_eltname = NULL;
                     psz_eltname = xml_ReaderName( p_xml_reader );
                     if( !psz_eltname )
                     {
index 28deb8018ebc67fd421767748755883189742e87..080b7b75ab9407c72b48fa818d114acb6895cf67 100644 (file)
@@ -255,8 +255,7 @@ static void End( vout_thread_t *p_vout )
 {
     vout_sys_t *p_sys = p_vout->p_sys;
 
-    if( p_sys->p_pixels )
-        free( p_sys->p_pixels );
+    free( p_sys->p_pixels );
 }
 
 static void Destroy( vlc_object_t *p_this )
@@ -265,7 +264,7 @@ static void Destroy( vlc_object_t *p_this )
     vout_sys_t *p_sys = p_vout->p_sys;
 
     CloseDisplay( p_vout );
-    if( p_sys ) free( p_sys );
+    free( p_sys );
     p_sys = NULL;
 }
 
index 0d697d284ea8abec6f6a9e3a9f1f2f795058922e..dc6c140741a45a81847f6dfe9ecb6a1c1d5821d4 100644 (file)
@@ -395,7 +395,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     psz_display = config_GetPsz( p_vout, "ggi_display" );
 
     p_vout->p_sys->p_display = ggiOpen( psz_display, NULL );
-    if( psz_display ) free( psz_display );
+    free( psz_display );
 
     if( p_vout->p_sys->p_display == NULL )
     {
index 915af9f1e2ffc45ebc25ada2c9fc01def089ecdb..82c1da11abc4c84b41a9185117ab818d6c717c95 100644 (file)
@@ -527,11 +527,8 @@ static void CloseVideo( vlc_object_t *p_this )
             p_vout->p_sys->i_spi_screensavetimeout, NULL, 0);
     }
 
-    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;
 }
 
 /*****************************************************************************
@@ -837,7 +834,7 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
         if( ( !device.psz_string || !*device.psz_string ) &&
             hmon == p_vout->p_sys->hmonitor )
         {
-            if( device.psz_string ) free( device.psz_string );
+            free( device.psz_string );
         }
         else if( strcmp( psz_drivername, device.psz_string ) == 0 )
         {
@@ -863,11 +860,11 @@ BOOL WINAPI DirectXEnumCallback( GUID* p_guid, LPTSTR psz_desc,
             }
 
             p_vout->p_sys->hmonitor = hmon;
-            if( device.psz_string ) free( device.psz_string );
+            free( device.psz_string );
         }
         else
         {
-            if( device.psz_string ) free( device.psz_string );
+            free( device.psz_string );
             return TRUE; /* Keep enumerating */
         }
 
@@ -1328,11 +1325,8 @@ static void DirectXCloseDDraw( vout_thread_t *p_vout )
         p_vout->p_sys->hddraw_dll = NULL;
     }
 
-    if( p_vout->p_sys->p_display_driver != NULL )
-    {
-        free( p_vout->p_sys->p_display_driver );
-        p_vout->p_sys->p_display_driver = NULL;
-    }
+    free( p_vout->p_sys->p_display_driver );
+    p_vout->p_sys->p_display_driver = NULL;
 
     p_vout->p_sys->hmonitor = NULL;
 }
index 0c50caf4a38034c22298d3bc4242d4d4e663923d..975519fdbedbaa0a01ba7a53bc94fe71f4f8f569 100644 (file)
@@ -316,7 +316,7 @@ void E_(EventThread)( event_thread_t *p_event )
             var_Get( p_event->p_vout, "video-title", &val );
             if( !val.psz_string || !*val.psz_string ) /* Default video title */
             {
-                if( val.psz_string ) free( val.psz_string );
+                free( val.psz_string );
 
 #ifdef MODULE_NAME_IS_wingdi
                 val.psz_string = strdup( VOUT_TITLE " (WinGDI output)" );
index a8835a9ce4a999a180cd9d0762da7bb0fb58b233..a3b1ba9a7d36e5f3bc2554ac538ebbe5725df237 100644 (file)
@@ -495,7 +495,7 @@ static int Init( vout_thread_t *p_vout )
         p_sys->i_effect = OPENGL_EFFECT_NONE;
 #endif
     }
-    if( val.psz_string ) free( val.psz_string );
+    free( val.psz_string );
 
     if( p_sys->i_effect & ( OPENGL_EFFECT_CUBE |
                 OPENGL_EFFECT_TRANSPARENT_CUBE ) )
@@ -553,8 +553,8 @@ static void End( vout_thread_t *p_vout )
 
     /* Free the texture buffer*/
     glDeleteTextures( 2, p_sys->p_textures );
-    if( p_sys->pp_buffer[0] ) free( p_sys->pp_buffer[0] );
-    if( p_sys->pp_buffer[1] ) free( p_sys->pp_buffer[1] );
+    free( p_sys->pp_buffer[0] );
+    free( p_sys->pp_buffer[1] );
 
     if( p_sys->p_vout->pf_unlock )
     {
index aa1b36f679faab54262c6d8586278829f594d376..0563c19c8bca2315ed668791739af7682555d521 100644 (file)
@@ -224,10 +224,10 @@ int E_(Activate) ( vlc_object_t *p_this )
         msg_Err( p_vout, "cannot open display %s",
                          XDisplayName( psz_display ) );
         free( p_vout->p_sys );
-        if( psz_display ) free( psz_display );
+        free( psz_display );
         return VLC_EGENERIC;
     }
-    if( psz_display ) free( psz_display );
+    free( psz_display );
 
     /* Replace error handler so we can intercept some non-fatal errors */
     XSetErrorHandler( X11ErrorHandler );
@@ -1698,7 +1698,7 @@ static int CreateWindow( vout_thread_t *p_vout, x11_window_t *p_win )
             XStoreName( p_vout->p_sys->p_display,
                         p_win->base_window, val.psz_string );
         }
-        if( val.psz_string ) free( val.psz_string );
+        free( val.psz_string );
 
         if( !p_vout->b_fullscreen )
         {