diff gui/interface.c @ 32537:8fa2f43cb760

Remove most of the NULL pointer check before free all over the code
author cboesch
date Sun, 14 Nov 2010 09:12:34 +0000
parents fbe5c829c69b
children 18338ee51c9d
line wrap: on
line diff
--- a/gui/interface.c	Sat Nov 13 10:23:34 2010 +0000
+++ b/gui/interface.c	Sun Nov 14 09:12:34 2010 +0000
@@ -104,7 +104,6 @@
 
 void gfree( void ** p )
 {
- if ( *p == NULL ) return;
  free( *p ); *p=NULL;
 }
 
@@ -363,19 +362,19 @@
  if ( vo_font )
   {
    int i;
-   if ( vo_font->name ) free( vo_font->name );
-   if ( vo_font->fpath ) free( vo_font->fpath );
+   free( vo_font->name );
+   free( vo_font->fpath );
    for ( i=0;i<16;i++ )
     if ( vo_font->pic_a[i] )
      {
-      if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp );
-      if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal );
+      free( vo_font->pic_a[i]->bmp );
+      free( vo_font->pic_a[i]->pal );
      }
    for ( i=0;i<16;i++ )
     if ( vo_font->pic_b[i] )
      {
-      if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp );
-      if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal );
+      free( vo_font->pic_b[i]->bmp );
+      free( vo_font->pic_b[i]->pal );
      }
    free( vo_font ); vo_font=NULL;
   }
@@ -968,8 +967,8 @@
 	   plList=curr->next;
 	 plCurrent=curr->next;
 	 // Free it
-	 if ( curr->path ) free( curr->path );
-	 if ( curr->name ) free( curr->name );
+	 free( curr->path );
+	 free( curr->name );
 	 free( curr );
         }
 	mplCurr(); // Instead of using mplNext && mplPrev
@@ -982,8 +981,8 @@
 	 if ( !plList ) return NULL;
 	 if ( !curr->next )
 	  {
-	   if ( curr->path ) free( curr->path );
-	   if ( curr->name ) free( curr->name );
+	   free( curr->path );
+	   free( curr->name );
 	   free( curr );
 	  }
 	  else
@@ -991,8 +990,8 @@
 	    while ( curr->next )
 	     {
 	      next=curr->next;
-	      if ( curr->path ) free( curr->path );
-	      if ( curr->name ) free( curr->name );
+	      free( curr->path );
+	      free( curr->name );
 	      free( curr );
 	      curr=next;
 	     }