summaryrefslogtreecommitdiff
path: root/build-aux/useless-if-before-free
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-01-28 09:27:32 +0100
committerJim Meyering <meyering@redhat.com>2009-01-28 09:27:32 +0100
commit636b8d6abf5b75d3cd96949c58519f100779c7e2 (patch)
treea2551a48b5dda2285e9d7a7da2841dd495a2ebcb /build-aux/useless-if-before-free
parent471cbb075f76e489fa96fad80bca65da7e01f683 (diff)
downloadgnulib-636b8d6abf5b75d3cd96949c58519f100779c7e2.tar.gz
useless-if-before-free: correction
It does *not* recognize "if (p != (void*)0) free(p);", since the RHS in this example may not contain ")"
Diffstat (limited to 'build-aux/useless-if-before-free')
-rwxr-xr-xbuild-aux/useless-if-before-free8
1 files changed, 3 insertions, 5 deletions
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index a2fc773c35..696c62147c 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -2,9 +2,9 @@
# Detect instances of "if (p) free (p);".
# Likewise for "if (p != NULL) free (p);". And with braces.
# Also detect "if (NULL != p) free (p);".
-# And with 0 or "(void *)0" in place of NULL.
+# And with 0 in place of NULL.
-my $VERSION = '2009-01-28 08:16'; # UTC
+my $VERSION = '2009-01-28 08:23'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
@@ -89,9 +89,7 @@ EOF
sub is_NULL ($)
{
my ($expr) = @_;
- return ($expr eq 'NULL'
- || $expr eq '0'
- || $expr =~ /^\(\s*(char|void)\s*\*\s*\)\s*0$/);
+ return ($expr eq 'NULL' || $expr eq '0');
}
{