summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary V. Vaughan <gary@gnu.org>2011-10-26 14:57:55 +0700
committerGary V. Vaughan <gary@gnu.org>2011-11-17 17:57:05 +0700
commitabc2b152d3e8a7427123cd651d888a6b3a6e5fde (patch)
treee0fca29d560e30b4b5074d384c2016bd72bbd1a6
parentdbc76d2f97a9a689ecf4a37e6e64e7eb3d468d18 (diff)
downloadlibtool-abc2b152d3e8a7427123cd651d888a6b3a6e5fde.tar.gz
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>
-rw-r--r--cfg.mk4
-rw-r--r--libltdl/libltdl/lt__alloc.h8
2 files changed, 5 insertions, 7 deletions
diff --git a/cfg.mk b/cfg.mk
index 22de32ca..46a1a96c 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -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!
diff --git a/libltdl/libltdl/lt__alloc.h b/libltdl/libltdl/lt__alloc.h
index 1ceddf00..45f7b523 100644
--- a/libltdl/libltdl/lt__alloc.h
+++ b/libltdl/libltdl/lt__alloc.h
@@ -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. */