diff m_option.c @ 32511:b39155e98ac3

Remove some useless NULL pointer checks before invoking free() on the pointer. patch by From: Clment Bsch, ubitux gmail com
author diego
date Sun, 07 Nov 2010 12:47:40 +0000
parents 92b92a78ca2a
children e1ee4895e500
line wrap: on
line diff
--- a/m_option.c	Sun Nov 07 11:03:47 2010 +0000
+++ b/m_option.c	Sun Nov 07 12:47:40 2010 +0000
@@ -400,8 +400,7 @@
   }
 
   if(dst) {
-    if(VAL(dst))
-      free(VAL(dst));
+    free(VAL(dst));
     VAL(dst) = strdup(param);
   }
 
@@ -416,7 +415,7 @@
 static void copy_str(const m_option_t* opt,void* dst, const void* src) {
   if(dst && src) {
 #ifndef NO_FREE
-    if(VAL(dst)) free(VAL(dst)); //FIXME!!!
+    free(VAL(dst)); //FIXME!!!
 #endif
     VAL(dst) = VAL(src) ? strdup(VAL(src)) : NULL;
   }
@@ -531,7 +530,7 @@
   free(del);
 
   if(s == 0) {
-    if(lst) free(lst);
+    free(lst);
     VAL(dst) = NULL;
     return 1;
   }
@@ -544,7 +543,7 @@
   }
   d[s] = NULL;
 
-  if(lst) free(lst);
+  free(lst);
   VAL(dst) = d;
 
   return 1;
@@ -737,7 +736,7 @@
   while(s) {
     n = s->next;
     free(s->name);
-    if(s->param) free(s->param);
+    free(s->param);
     free(s);
     s = n;
   }