summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-05-12 07:55:15 +0000
committerJim Meyering <jim@meyering.net>2005-05-12 07:55:15 +0000
commit55646e00b95e1ad2ea193ee3042dca41dd705e3a (patch)
tree95f983dc0821b57d600998789930964c6950f9d0
parent258fbb886034baf260e1a5ed5c3446cce9fa6fb4 (diff)
downloadcoreutils-55646e00b95e1ad2ea193ee3042dca41dd705e3a.tar.xz
Assume `free (NULL)' works.
-rw-r--r--src/ls.c12
-rw-r--r--src/md5sum.c3
-rw-r--r--src/pr.c39
3 files changed, 18 insertions, 36 deletions
diff --git a/src/ls.c b/src/ls.c
index 5795fc99b..39a3e48af 100644
--- 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))
diff --git a/src/md5sum.c b/src/md5sum.c
index 400f675fa..8f2a67d29 100644
--- a/src/md5sum.c
+++ b/src/md5sum.c
@@ -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))
{
diff --git a/src/pr.c b/src/pr.c
index 9cba88bf7..45f9ff2e5 100644
--- 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));
}
@@ -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);
}
/* Complain, print a usage message, and die. */