summaryrefslogtreecommitdiff
path: root/build-aux/useless-if-before-free
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/useless-if-before-free')
-rwxr-xr-xbuild-aux/useless-if-before-free14
1 files changed, 7 insertions, 7 deletions
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index a6c228b..663347a 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -4,13 +4,13 @@ eval '(exit $?0)' && eval 'exec perl -wST "$0" ${1+"$@"}'
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
-my $VERSION = '2011-01-09 01:39'; # UTC
+my $VERSION = '2012-01-06 07: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
# do its job. Otherwise, update this string manually.
-# Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# Copyright (C) 2008-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ sub usage ($)
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
if ($exit_code != 0)
{
- print $STREAM "Try `$ME --help' for more information.\n";
+ print $STREAM "Try '$ME --help' for more information.\n";
}
else
{
@@ -62,7 +62,7 @@ detect free-like functions named FOO and BAR.
OPTIONS:
--list print only the name of each matching FILE (\\0-terminated)
- --name=N add name N to the list of \`free\'-like functions to detect;
+ --name=N add name N to the list of \'free\'-like functions to detect;
may be repeated
--help display this help and exit
@@ -125,14 +125,14 @@ sub is_NULL ($)
foreach my $file (@ARGV)
{
open FH, '<', $file
- or (warn "$ME: can't open `$file' for reading: $!\n"),
+ or (warn "$ME: can't open '$file' for reading: $!\n"),
$err = EXIT_ERROR, next;
while (defined (my $line = <FH>))
{
while ($line =~
/\b(if\s*\(\s*([^)]+?)(?:\s*!=\s*([^)]+?))?\s*\)
# 1 2 3
- (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)|
+ (?: \s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;|
\s*\{\s*$regexp\s*\((?:\s*\([^)]+\))?\s*([^)]+)\)\s*;\s*\}))/sxg)
{
my $all = $1;
@@ -179,7 +179,7 @@ free=xfree
git grep -l -z "$free *(" \
| xargs -0 useless-if-before-free -l --name="$free" \
| xargs -0 perl -0x3b -pi -e \
- 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\))/$2/s'
+ 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*(?:0|NULL))?\s*\)\s+('"$free"'\s*\((?:\s*\([^)]+\))?\s*\1\s*\)\s*;)/$2/s'
# Use the following to remove redundant uses of kfree inside braces.
# Note that -0777 puts perl in slurp-whole-file mode;