[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Recognize optional cast of the argument to free.
From: |
Jim Meyering |
Subject: |
[PATCH] Recognize optional cast of the argument to free. |
Date: |
Wed, 12 Mar 2008 14:09:43 +0100 |
My useless-if-before-free script did not detect uses
like this (with a cast):
if (s)
free ((void *) s)
Now it does:
diff --git a/ChangeLog b/ChangeLog
index 749d1cd..11152c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2008-03-12 Jim Meyering <address@hidden>
+ Recognize optional cast of the argument to free.
+ * build-aux/useless-if-before-free: Update regexps.
+
* build-aux/bootstrap (gnulib_tool): Remove trailing blanks.
2008-03-11 Bruno Haible <address@hidden>
diff --git a/build-aux/useless-if-before-free b/build-aux/useless-if-before-free
index eb18483..626d19a 100755
--- a/build-aux/useless-if-before-free
+++ b/build-aux/useless-if-before-free
@@ -123,8 +123,8 @@ EOF
{
if ($line =~
/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
- (?: \s*$regexp\s*\(\s*\2\s*\)|
- \s*\{\s*$regexp\s*\(\s*\2\s*\)\s*;\s*\}))/sx)
+ (?: \s*$regexp\s*\((?:\s*\([^)]+\))\s*\2\s*\)|
+ \s*\{\s*$regexp\s*\((?:\s*\([^)]+\))\s*\2\s*\)\s*;\s*\}))/sx)
{
$found_match = 1;
$list
--
1.5.4.4.482.g5f904
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Recognize optional cast of the argument to free.,
Jim Meyering <=