Also detect and remove unnecessary if-before-xmlXPathFreeContext.

* build-aux/find-unnecessary-if-before-free: Update regexp.
* src/openvz_conf.c: Remove unnecessary "if (P)"-before xmlXPathFreeContext.
* src/qemu_conf.c: Likewise.
* src/virsh.c: Likewise.
* src/xm_internal.c: Likewise.
* src/xml.c: Likewise.
* tests/xmlrpctest.c: Likewise.
This commit is contained in:
Jim Meyering
2008-01-29 18:23:43 +00:00
parent 1be2c8c814
commit 2367caa327
8 changed files with 23 additions and 25 deletions

View File

@@ -22,7 +22,7 @@ use warnings;
{
if ($line =~
/\b(if\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)
\s+(?:sexpr_)?free\s*\(\s*\2\s*\))/sx)
\s+(?:xmlXPathFreeContext|(?:sexpr_)?free)\s*\(\s*\2\s*\))/sx)
{
print "$file: $1\n";
$found_match = 1;
@@ -37,6 +37,6 @@ my $foo = <<'EOF';
# The above is to *find* them.
# This adjusts them, removing the unnecessary "if (p)" part.
git ls-files -z |xargs -0 \
perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+((?:sexpr_)?free\s*\(\s*\1\s*\))/$2/s'
git ls-files -z --exclude=find-unnecessary-if-before-free |xargs -0 \
perl -0x3b -pi -e 's/\bif\s*\(\s*(\S+?)(?:\s*!=\s*NULL)?\s*\)\s+((?:xmlXPathFreeContext|(?:sexpr_)?free)\s*\(\s*\1\s*\))/$2/s'
EOF