[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/25] syntax-check: fix violations and re-enable sc_avoid_if_bef
From: |
Gary V. Vaughan |
Subject: |
[PATCH 02/25] syntax-check: fix violations and re-enable sc_avoid_if_before_free. |
Date: |
Tue, 15 Nov 2011 19:53:40 +0700 |
* 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 <address@hidden>
---
cfg.mk | 4 +---
libltdl/libltdl/lt__alloc.h | 8 ++++----
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 22de32c..46a1a96 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 1ceddf0..45f7b52 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. */
--
1.7.7.3
Cheers,
--
Gary V. Vaughan (gary AT gnu DOT org)