changeset 95479:9588c3703f38

remove useless if-before-free tests * lib-src/ebrowse.c (xfree): Likewise. * lib-src/etags.c (process_file_name, free_tree, free_fdesc): Likewise. (popclass_above, Prolog_functions, Erlang_functions): Likewise. * lib-src/pop.c (pop_quit): Likewise. * lwlib/lwlib-Xm.c (xm_update_one_value): Likewise. * lwlib/lwlib.c (safe_free_str, free_widget_value_tree): Likewise. * src/editfns.c (Fset_time_zone_rule): Likewise. * src/lread.c (nosuffix): Likewise. * src/ralloc.c (get_bloc): Likewise. * src/regex.c (reg_free): Likewise. * src/xftfont.c (xftfont_open, xftfont_close): Likewise. * src/xrdb.c (get_user_app, get_environ_db, x_load_resources): Likewise. * src/xsmfns.c (smc_save_yourself_CB): Likewise.
author Jim Meyering <jim@meyering.net>
date Mon, 02 Jun 2008 06:00:54 +0000
parents e21a3997eb7c
children 1c16540a2329
files lib-src/ChangeLog lib-src/ebrowse.c lib-src/etags.c lib-src/pop.c lwlib/ChangeLog lwlib/lwlib-Xm.c lwlib/lwlib.c src/ChangeLog src/editfns.c src/lread.c src/ralloc.c src/regex.c src/xrdb.c src/xsmfns.c
diffstat 14 files changed, 57 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Mon Jun 02 05:26:26 2008 +0000
+++ b/lib-src/ChangeLog	Mon Jun 02 06:00:54 2008 +0000
@@ -1,3 +1,11 @@
+2008-06-02  Jim Meyering  <meyering@redhat.com>
+
+	remove useless if-before-free tests
+	* lib-src/ebrowse.c (xfree): Likewise.
+	* lib-src/etags.c (process_file_name, free_tree, free_fdesc): Likewise.
+	(popclass_above, Prolog_functions, Erlang_functions): Likewise.
+	* lib-src/pop.c (pop_quit): Likewise.
+
 2008-05-30  Juanma Barranquero  <lekktu@gmail.com>
 
 	* makefile.w32-in (lisp2): Add minibuffer.elc.
--- a/lib-src/ebrowse.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/lib-src/ebrowse.c	Mon Jun 02 06:00:54 2008 +0000
@@ -595,8 +595,7 @@
 xfree (p)
      void *p;
 {
-  if (p)
-    free (p);
+  free (p);
 }
 
 
--- a/lib-src/etags.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/lib-src/etags.c	Mon Jun 02 06:00:54 2008 +0000
@@ -1799,8 +1799,8 @@
     pfatal (file);
 
  cleanup:
-  if (compressed_name) free (compressed_name);
-  if (uncompressed_name) free (uncompressed_name);
+  free (compressed_name);
+  free (uncompressed_name);
   last_node = NULL;
   curfdp = NULL;
   return;
@@ -2179,8 +2179,7 @@
     {
       register node *node_right = np->right;
       free_tree (np->left);
-      if (np->name != NULL)
-	free (np->name);
+      free (np->name);
       free (np->regex);
       free (np);
       np = node_right;
@@ -2195,11 +2194,11 @@
 free_fdesc (fdp)
      register fdesc *fdp;
 {
-  if (fdp->infname != NULL) free (fdp->infname);
-  if (fdp->infabsname != NULL) free (fdp->infabsname);
-  if (fdp->infabsdir != NULL) free (fdp->infabsdir);
-  if (fdp->taggedfname != NULL) free (fdp->taggedfname);
-  if (fdp->prop != NULL) free (fdp->prop);
+  free (fdp->infname);
+  free (fdp->infabsname);
+  free (fdp->infabsdir);
+  free (fdp->taggedfname);
+  free (fdp->prop);
   free (fdp);
 }
 
@@ -2844,8 +2843,7 @@
        nl >= 0 && cstack.bracelev[nl] >= bracelev;
        nl--)
     {
-      if (cstack.cname[nl] != NULL)
-	free (cstack.cname[nl]);
+      free (cstack.cname[nl]);
       cstack.nl = nl;
     }
 }
@@ -5521,8 +5519,7 @@
 	  last[len] = '\0';
 	}
     }
-  if (last != NULL)
-    free (last);
+  free (last);
 }
 
 
@@ -5700,8 +5697,7 @@
 	  last[len] = '\0';
 	}
     }
-  if (last != NULL)
-    free (last);
+  free (last);
 }
 
 
--- a/lib-src/pop.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/lib-src/pop.c	Mon Jun 02 06:00:54 2008 +0000
@@ -998,8 +998,7 @@
       close (server->file);
     }
 
-  if (server->buffer)
-    free (server->buffer);
+  free (server->buffer);
   free ((char *) server);
 
   return (ret);
--- a/lwlib/ChangeLog	Mon Jun 02 05:26:26 2008 +0000
+++ b/lwlib/ChangeLog	Mon Jun 02 06:00:54 2008 +0000
@@ -1,3 +1,9 @@
+2008-06-02  Jim Meyering  <meyering@redhat.com>
+
+	remove useless if-before-free tests
+	* lwlib/lwlib-Xm.c (xm_update_one_value): Likewise.
+	* lwlib/lwlib.c (safe_free_str, free_widget_value_tree): Likewise.
+
 2008-04-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* Makefile.in (TOOLKIT_DEFINES): Remove.
--- a/lwlib/lwlib-Xm.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/lwlib/lwlib-Xm.c	Mon Jun 02 06:00:54 2008 +0000
@@ -956,15 +956,13 @@
     }
   else if (class == xmTextWidgetClass)
     {
-      if (val->value)
-	free (val->value);
+      free (val->value);
       val->value = XmTextGetString (widget);
       val->edited = True;
     }
   else if (class == xmTextFieldWidgetClass)
     {
-      if (val->value)
-	free (val->value);
+      free (val->value);
       val->value = XmTextFieldGetString (widget);
       val->edited = True;
     }
@@ -989,8 +987,7 @@
 	      XtVaGetValues (toggle, XmNset, &set, NULL);
 	      if (set)
 		{
-		  if (val->value)
-		    free (val->value);
+		  free (val->value);
 		  val->value = safe_strdup (XtName (toggle));
 		}
 	    }
--- a/lwlib/lwlib.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/lwlib/lwlib.c	Mon Jun 02 06:00:54 2008 +0000
@@ -170,7 +170,7 @@
 safe_free_str (s)
      char *s;
 {
-  if (s) free (s);
+  free (s);
 }
 
 static widget_value *widget_value_free_list = 0;
@@ -226,9 +226,9 @@
   if (!wv)
     return;
 
-  if (wv->name) free (wv->name);
-  if (wv->value) free (wv->value);
-  if (wv->key) free (wv->key);
+  free (wv->name);
+  free (wv->value);
+  free (wv->key);
 
   wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
 
--- a/src/ChangeLog	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/ChangeLog	Mon Jun 02 06:00:54 2008 +0000
@@ -1,3 +1,14 @@
+2008-06-02  Jim Meyering  <meyering@redhat.com>
+
+	remove useless if-before-free tests
+	* src/editfns.c (Fset_time_zone_rule): Likewise.
+	* src/lread.c (nosuffix): Likewise.
+	* src/ralloc.c (get_bloc): Likewise.
+	* src/regex.c (reg_free): Likewise.
+	* src/xftfont.c (xftfont_open, xftfont_close): Likewise.
+	* src/xrdb.c (get_user_app, get_environ_db, x_load_resources): Likewise.
+	* src/xsmfns.c (smc_save_yourself_CB): Likewise.
+
 2008-06-02  Kenichi Handa  <handa@m17n.org>
 
 	* font.c (font_find_for_lface): Handle float font size.
--- a/src/editfns.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/editfns.c	Mon Jun 02 06:00:54 2008 +0000
@@ -2038,8 +2038,7 @@
     }
 
   set_time_zone_rule (tzstring);
-  if (environbuf)
-    free (environbuf);
+  free (environbuf);
   environbuf = environ;
 
   return Qnil;
--- a/src/lread.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/lread.c	Mon Jun 02 06:00:54 2008 +0000
@@ -1269,8 +1269,7 @@
 
   UNGCPRO;
 
-  if (saved_doc_string)
-    free (saved_doc_string);
+  free (saved_doc_string);
   saved_doc_string = 0;
   saved_doc_string_size = 0;
 
--- a/src/ralloc.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/ralloc.c	Mon Jun 02 06:00:54 2008 +0000
@@ -425,8 +425,7 @@
   if (! (new_bloc = (bloc_ptr) malloc (BLOC_PTR_SIZE))
       || ! (new_bloc->data = obtain (break_value, size)))
     {
-      if (new_bloc)
-	free (new_bloc);
+      free (new_bloc);
 
       return 0;
     }
--- a/src/regex.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/regex.c	Mon Jun 02 06:00:54 2008 +0000
@@ -6841,20 +6841,17 @@
 regfree (preg)
     regex_t *preg;
 {
-  if (preg->buffer != NULL)
-    free (preg->buffer);
+  free (preg->buffer);
   preg->buffer = NULL;
 
   preg->allocated = 0;
   preg->used = 0;
 
-  if (preg->fastmap != NULL)
-    free (preg->fastmap);
+  free (preg->fastmap);
   preg->fastmap = NULL;
   preg->fastmap_accurate = 0;
 
-  if (preg->translate != NULL)
-    free (preg->translate);
+  free (preg->translate);
   preg->translate = NULL;
 }
 WEAK_ALIAS (__regfree, regfree)
--- a/src/xrdb.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/xrdb.c	Mon Jun 02 06:00:54 2008 +0000
@@ -431,13 +431,11 @@
     {
       XrmDatabase db = XrmGetFileDatabase (file);
       free (file);
-      if (free_it)
-	free (free_it);
+      free (free_it);
       return db;
     }
 
-  if (free_it)
-    free (free_it);
+  free (free_it);
   return NULL;
 }
 
@@ -504,8 +502,8 @@
 
   db = XrmGetFileDatabase (p);
 
-  if (path) free (path);
-  if (home) free (home);
+  free (path);
+  free (home);
 
   return db;
 }
@@ -612,8 +610,7 @@
 
   /* Figure out what the "customization string" is, so we can use it
      to decode paths.  */
-  if (x_customization_string)
-    free (x_customization_string);
+  free (x_customization_string);
   x_customization_string
     = x_get_customization_string (user_database, myname, myclass);
 
--- a/src/xsmfns.c	Mon Jun 02 05:26:26 2008 +0000
+++ b/src/xsmfns.c	Mon Jun 02 06:00:54 2008 +0000
@@ -262,8 +262,7 @@
 
   xfree (smid_opt);
 
-  if (cwd)
-    free (cwd);
+  free (cwd);
 
   /* See if we maybe shall interact with the user.  */
   if (interactStyle != SmInteractStyleAny