avoid useless if-before-free tests
Joseph S. Myers
joseph@codesourcery.com
Sat Mar 5 19:16:00 GMT 2011
On Sat, 5 Mar 2011, Jim Meyering wrote:
> diff --git a/gcc/config/i386/gmm_malloc.h b/gcc/config/i386/gmm_malloc.h
> index 7a7e840..8993fc7 100644
> --- a/gcc/config/i386/gmm_malloc.h
> +++ b/gcc/config/i386/gmm_malloc.h
> @@ -67,8 +67,7 @@ _mm_malloc (size_t size, size_t align)
> static __inline__ void
> _mm_free (void * aligned_ptr)
> {
> - if (aligned_ptr)
> - free (((void **) aligned_ptr) [-1]);
> + free (((void **) aligned_ptr) [-1]);
> }
This one looks suspicious; it's not if (p) free (p); but if (p) free
(something-derived-from-p);.
> diff --git a/libjava/classpath/native/fdlibm/dtoa.c b/libjava/classpath/native/fdlibm/dtoa.c
> index 458e629..92aa793 100644
http://gcc.gnu.org/codingconventions.html says Classpath changes should go
via Classpath upstream, not directly into GCC. I don't know if that's
still accurate.
> diff --git a/zlib/contrib/minizip/unzip.c b/zlib/contrib/minizip/unzip.c
> index 9ad4766..644ef1b 100644
We definitely don't want to make local changes to zlib for this sort of
issue, though importing a new upstream version of zlib (making sure the
local configure code still works) should be fine for 4.7.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list