2008-03-02 Jim Meyering <meyering@redhat.com>
+ Remove useless "if" tests before free. Deprecate "free" module.
+ * doc/posix-functions/free.texi: Mention that this
+ module is no longer useful.
+ * modules/free (Notice): Say this module is obsolete.
+ * modules/readutmp (Depends-on): Remove free.
+ * lib/save-cwd.c (free_cwd): Remove useless "if" before free.
+ * lib/putenv.c (putenv): Likewise.
+ * lib/gc-gnulib.c (gc_cipher_close): Likewise.
+ * lib/getaddrinfo.c (freeaddrinfo): Likewise.
+ * tests/test-c-strcasestr.c (main): Likewise.
+ * tests/test-c-strstr.c (main): Likewise.
+ * tests/test-mbscasestr1.c (main): Likewise.
+ * tests/test-mbscasestr2.c (main): Likewise.
+ * tests/test-mbsstr1.c (main): Likewise.
+ * tests/test-mbsstr2.c (main): Likewise.
+ * tests/test-memmem.c (main): Likewise.
+ * tests/test-strcasestr.c (main): Likewise.
+ * tests/test-striconv.c (main): Likewise.
+ * tests/test-striconveh.c (main): Likewise.
+ * tests/test-striconveha.c (main): Likewise.
+ * tests/test-strstr.c (main): Likewise.
+
* build-aux/git-version-gen: Adjust a comment and the Usage string.
bootstrap: sync from coreutils again
Portability problems fixed by Gnulib:
@itemize
@item
-On old platforms, @code{free (NULL)} is not allowed.
+On old platforms such as SunOS4, @code{free (NULL)} fails.
+However, since all such systems are so old as to no longer
+be considered ``reasonable portability targets,''
+this module is no longer useful.
@end itemize
Portability problems not fixed by Gnulib:
{
_gc_cipher_ctx *ctx = handle;
- if (ctx)
- free (ctx);
+ free (ctx);
return GC_OK;
}
cur = ai;
ai = ai->ai_next;
- if (cur->ai_canonname) free (cur->ai_canonname);
+ free (cur->ai_canonname);
free (cur);
}
}
-/* Copyright (C) 1991, 1994, 1997, 1998, 2000, 2003, 2004, 2005, 2006, 2007
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2008
Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C
size * sizeof (char *));
new_environ[size] = (char *) string;
new_environ[size + 1] = NULL;
- if (last_environ != NULL)
- free (last_environ);
+ free (last_environ);
last_environ = new_environ;
environ = new_environ;
}
{
if (cwd->desc >= 0)
close (cwd->desc);
- if (cwd->name)
- free (cwd->name);
+ free (cwd->name);
}
Description:
Work around incompatibility on older systems where free (NULL) fails.
+Notice:
+This module is obsolete.
+
Files:
lib/free.c
m4/free.m4
Maintainer:
Paul Eggert
-
Depends-on:
extensions
xalloc
-free
stdbool
configure.ac:
result = c_strcasestr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
result = c_strstr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
result = mbscasestr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
result = mbscasestr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
result = mbsstr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
result = mbsstr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
result = memmem (haystack, 2 * m + 1, needle, m + 1);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
/* Check that long needles not present in a haystack can be handled
ASSERT (result == NULL);
}
}
- if (haystack != NULL)
- free (haystack);
- if (needle != NULL)
- free (needle);
+ free (haystack);
+ free (needle);
}
return 0;
result = strcasestr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
return 0;
&result, &length);
ASSERT (retval == 0);
ASSERT (length == 0);
- if (result != NULL)
- free (result);
+ free (result);
}
/* ------------------------- Test str_cd_iconv() ------------------------- */
ASSERT (offsets[1] == MAGIC);
free (offsets);
}
- if (result != NULL)
- free (result);
+ free (result);
}
}
ASSERT (offsets[1] == MAGIC);
free (offsets);
}
- if (result != NULL)
- free (result);
+ free (result);
}
}
ASSERT (offsets[1] == MAGIC);
free (offsets);
}
- if (result != NULL)
- free (result);
+ free (result);
}
}
result = strstr (haystack, needle);
ASSERT (result == haystack + m);
}
- if (needle != NULL)
- free (needle);
- if (haystack != NULL)
- free (haystack);
+ free (needle);
+ free (haystack);
}
/* Sublinear speed is only possible in memmem; strstr must examine