remove useless if-before-free tests
Change "if (E) free (E);" to "free (E);" everywhere except in the libgo/, intl/, zlib/ and classpath/ directories. Also transform equivalent variants like "if (E != NULL) free (E);" and allow an extra cast on the argument to free. Otherwise, the tested and freed "E" expressions must be identical, modulo white space. From-SVN: r172785
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2011-04-20 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
* files.c (destroy_cpp_file): Remove useless if-before-free.
|
||||
* init.c (cpp_destroy): Likewise.
|
||||
* macro.c (replace_args): Likewise.
|
||||
* pch.c (cpp_valid_state): Likewise.
|
||||
|
||||
2011-03-25 Kai Tietz <ktietz@redhat.com>
|
||||
|
||||
* files.c (file_hash_eq): Use filename_cmp
|
||||
|
||||
+1
-2
@@ -996,8 +996,7 @@ make_cpp_file (cpp_reader *pfile, cpp_dir *dir, const char *fname)
|
||||
static void
|
||||
destroy_cpp_file (_cpp_file *file)
|
||||
{
|
||||
if (file->buffer_start)
|
||||
free ((void *) file->buffer_start);
|
||||
free ((void *) file->buffer_start);
|
||||
free ((void *) file->name);
|
||||
free (file);
|
||||
}
|
||||
|
||||
+1
-2
@@ -259,8 +259,7 @@ cpp_destroy (cpp_reader *pfile)
|
||||
while (CPP_BUFFER (pfile) != NULL)
|
||||
_cpp_pop_buffer (pfile);
|
||||
|
||||
if (pfile->out.base)
|
||||
free (pfile->out.base);
|
||||
free (pfile->out.base);
|
||||
|
||||
if (pfile->macro_buffer)
|
||||
{
|
||||
|
||||
+1
-2
@@ -1064,8 +1064,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg
|
||||
|
||||
/* Free the expanded arguments. */
|
||||
for (i = 0; i < macro->paramc; i++)
|
||||
if (args[i].expanded)
|
||||
free (args[i].expanded);
|
||||
free (args[i].expanded);
|
||||
|
||||
push_ptoken_context (pfile, node, buff, first, dest - first);
|
||||
}
|
||||
|
||||
+3
-6
@@ -713,12 +713,9 @@ cpp_valid_state (cpp_reader *r, const char *name, int fd)
|
||||
return -1;
|
||||
|
||||
fail:
|
||||
if (namebuf != NULL)
|
||||
free (namebuf);
|
||||
if (undeftab != NULL)
|
||||
free (undeftab);
|
||||
if (nl.defs != NULL)
|
||||
free (nl.defs);
|
||||
free (namebuf);
|
||||
free (undeftab);
|
||||
free (nl.defs);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user