bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: removing useless if-before-free tests


From: Jim Meyering
Subject: Re: removing useless if-before-free tests
Date: Mon, 18 Feb 2008 14:52:09 +0100

Jim Meyering <address@hidden> wrote:
> I propose to remove tests like this:
>
>       * lib/save-cwd.c (free_cwd): Remove now-useless if-before-free.
>
> diff --git a/lib/save-cwd.c b/lib/save-cwd.c
> index 7618f09..e158e8b 100644
> --- a/lib/save-cwd.c
> +++ b/lib/save-cwd.c
> @@ -97,6 +97,5 @@ free_cwd (struct saved_cwd *cwd)
>  {
>    if (cwd->desc >= 0)
>      close (cwd->desc);
> -  if (cwd->name)
> -    free (cwd->name);
> +  free (cwd->name);
>  }

Bruno,

Other than save-cwd.c and putenv.c (which I'll handle),
and Simon's getaddrinfo.c, most of the files with such redundant
"if" tests are in your modules.

Are you open to the idea?
If so, I'll be happy to propose the patch.

$ mkid && ./build-aux/useless-if-before-free -l $(lid -knone free)|tr '\0' '\n'
lib/csharpcomp.c
lib/fchdir.c
lib/free.c
lib/fstrcmp.c
lib/gc-gnulib.c
lib/getaddrinfo.c
lib/gl_carray_list.c
lib/localcharset.c
lib/lock.c
lib/printf-parse.c
lib/putenv.c
lib/relocatable.c
lib/save-cwd.c
lib/striconv.c
lib/vasnprintf.c
tests/test-c-strcasestr.c
tests/test-c-strstr.c
tests/test-mbscasestr1.c
tests/test-mbscasestr2.c
tests/test-mbsstr1.c
tests/test-mbsstr2.c
tests/test-memmem.c
tests/test-strcasestr.c
tests/test-striconv.c
tests/test-striconveh.c
tests/test-striconveha.c
tests/test-strstr.c




reply via email to

[Prev in Thread] Current Thread [Next in Thread]