syntax-check: fix violations and re-enable sc_avoid_if_before_free.

* cfg.mk (local-checks-to-fix): Remove sc_avoid_if_before_free
from list of disabled checks.
According to gnulib/doc/free.texi: "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."
* libltdl/libltdl/lt__alloc.h (FREE, MEMREASSIGN): Don't protect
against freeing NULL bug on SunOS4.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
This commit is contained in:
Gary V. Vaughan 2011-10-26 14:57:55 +07:00
parent dbc76d2f97
commit abc2b152d3
2 changed files with 5 additions and 7 deletions

4
cfg.mk
View File

@ -62,7 +62,6 @@ local-checks-to-fix = \
local-checks-to-skip = \
$(local-checks-to-fix) \
sc_GPL_version \
sc_avoid_if_before_free \
sc_bindtextdomain \
sc_cast_of_argument_to_free \
sc_cast_of_x_alloc_return_value \
@ -72,8 +71,7 @@ local-checks-to-skip = \
# GPL_version: checks for GPLv3, which we don't use
# bindtextdomain: libtool isn't internationalized
# avoid_if_before_free: we don't use the gnulib malloc modules
# cast_of_argument_to_free: ditto
# cast_of_argument_to_free: we don't use gnulib alloc modules
# cast_of_x_alloc_return_value: ditto
# error_message_uppercase: we like our error messages
# program_name: libtool has no programs!

View File

@ -37,10 +37,10 @@ LT_BEGIN_C_DECLS
#define MALLOC(tp, n) (tp*) lt__malloc((n) * sizeof(tp))
#define REALLOC(tp, mem, n) (tp*) lt__realloc((mem), (n) * sizeof(tp))
#define FREE(mem) LT_STMT_START { \
if (mem) { free ((void *)mem); mem = NULL; } } LT_STMT_END
#define MEMREASSIGN(p, q) LT_STMT_START { \
if ((p) != (q)) { if (p) free (p); (p) = (q); (q) = 0; } \
#define FREE(mem) LT_STMT_START { \
free ((void *)mem); mem = NULL; } LT_STMT_END
#define MEMREASSIGN(p, q) LT_STMT_START { \
if ((p) != (q)) { free (p); (p) = (q); (q) = 0; } \
} LT_STMT_END
/* If set, this function is called when memory allocation has failed. */