X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=inline;f=build-aux%2Fuseless-if-before-free;h=b8f5a2635e89cf4246bedcbd3e0e4709947b6325;hb=b6772983c800c6faee7fc793b83975afb6d58bcc;hp=a6c228bcf4d43a863c41171c50a3bafde376ba1f;hpb=d599e5add275f75ed08e6527b8ee4d3f4f7c3aea;p=gnulib.git diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free index a6c228bcf..b8f5a2635 100755 --- a/build-aux/useless-if-before-free +++ b/build-aux/useless-if-before-free @@ -4,7 +4,7 @@ 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 = '2011-04-20 13:43'; # 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 @@ -132,7 +132,7 @@ sub is_NULL ($) 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;