]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Assume `free (NULL)' works.
authorJim Meyering <jim@meyering.net>
Thu, 12 May 2005 07:55:15 +0000 (07:55 +0000)
committerJim Meyering <jim@meyering.net>
Thu, 12 May 2005 07:55:15 +0000 (07:55 +0000)
src/ls.c
src/md5sum.c
src/pr.c

index 5795fc99b19be53278bf65289f44602b28e08cf7..39a3e48af374687b7c6d89eccc91130ea88e06f9 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -1005,10 +1005,8 @@ visit_dir (dev_t dev, ino_t ino)
 static void
 free_pending_ent (struct pending *p)
 {
-  if (p->name)
-    free (p->name);
-  if (p->realname)
-    free (p->realname);
+  free (p->name);
+  free (p->realname);
   free (p);
 }
 
@@ -2448,8 +2446,7 @@ clear_files (void)
   for (i = 0; i < files_index; i++)
     {
       free (files[i].name);
-      if (files[i].linkname)
-       free (files[i].linkname);
+      free (files[i].linkname);
     }
 
   files_index = 0;
@@ -2599,8 +2596,7 @@ gobble_file (char const *name, enum filetype type, bool command_line_arg,
                  f->linkok = true;
                }
            }
-         if (linkpath)
-           free (linkpath);
+         free (linkpath);
        }
 
       if (S_ISLNK (f->stat.st_mode))
index 400f675fad8101456925286101aef54252446e0a..8f2a67d298e3e3b7a763d3eda62065a1d1e6698b 100644 (file)
@@ -498,8 +498,7 @@ digest_check (const char *checkfile_name, int (*digest_stream) (FILE *, void *))
     }
   while (!feof (checkfile_stream) && !ferror (checkfile_stream));
 
-  if (line)
-    free (line);
+  free (line);
 
   if (ferror (checkfile_stream))
     {
index 9cba88bf7d1e7517315a499fa672a905555cfc63..45f9ff2e54023d62dd95418cc57552d6cea1e304 100644 (file)
--- a/src/pr.c
+++ b/src/pr.c
@@ -1313,8 +1313,7 @@ init_parameters (int number_of_files)
 
   if (numbered_lines)
     {
-      if (number_buff != NULL)
-       free (number_buff);
+      free (number_buff);
       number_buff = xmalloc (2 * chars_per_number);
     }
 
@@ -1323,8 +1322,7 @@ init_parameters (int number_of_files)
      The width of an escape sequence (4) isn't the lower limit any longer.
      We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
      to expand a tab which is not an input_tab-char. */
-  if (clump_buff != NULL)
-    free (clump_buff);
+  free (clump_buff);
   clump_buff = xmalloc (MAX (8, chars_per_input_tab));
 }
 \f
@@ -1349,8 +1347,7 @@ init_fps (int number_of_files, char **av)
 
   total_files = 0;
 
-  if (column_vector != NULLCOL)
-    free (column_vector);
+  free (column_vector);
   column_vector = xnmalloc (columns, sizeof (COLUMN));
 
   if (parallel_files)
@@ -1694,8 +1691,7 @@ init_header (char *filename, int desc)
       nstrftime (buf, bufsize, date_format, tm, 0, ns);
     }
 
-  if (date_text)
-    free (date_text);
+  free (date_text);
   date_text = buf;
   file_text = custom_header ? custom_header : desc < 0 ? "" : filename;
   header_width_available = (chars_per_line
@@ -1928,17 +1924,14 @@ init_store_cols (void)
   int total_lines = lines_per_body * columns;
   int chars_if_truncate = total_lines * (chars_per_column + 1);
 
-  if (line_vector != NULL)
-    free (line_vector);
+  free (line_vector);
   /* FIXME: here's where it was allocated.  */
   line_vector = xmalloc ((total_lines + 1) * sizeof (int *));
 
-  if (end_vector != NULL)
-    free (end_vector);
+  free (end_vector);
   end_vector = xmalloc (total_lines * sizeof (int *));
 
-  if (buff != NULL)
-    free (buff);
+  free (buff);
   buff_allocated = (use_col_separator
                    ? 2 * chars_if_truncate
                    : chars_if_truncate);       /* Tune this. */
@@ -2756,18 +2749,12 @@ char_to_clump (char c)
 static void
 cleanup (void)
 {
-  if (number_buff)
-    free (number_buff);
-  if (clump_buff)
-    free (clump_buff);
-  if (column_vector)
-    free (column_vector);
-  if (line_vector)
-    free (line_vector);
-  if (end_vector)
-    free (end_vector);
-  if (buff)
-    free (buff);
+  free (number_buff);
+  free (clump_buff);
+  free (column_vector);
+  free (line_vector);
+  free (end_vector);
+  free (buff);
 }
 \f
 /* Complain, print a usage message, and die. */