mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user