Re: Remove useless "if (foo)" before "free (foo)".

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 22, 2008 at 10:48:22PM +0100, Jim Meyering wrote:
> Likewise, given if (foo != NULL) free (foo); remove the useless "if" test.
> Do the same for sexpr_free, since it has similar semantics.
> 
> Detect with this:
> (-0x3b tells Perl to use ';' as the input record separator)
> 
>   perl -0x3b -ne '/\b(if \((.+?)(?:\s*!=\s*NULL\s*)?\)\s+(sexpr_)?free *\(\2\))/s and print "$ARGV: $1\n"'\ $(git ls-files)
> 
> Note that it also changes the code produced by generator.py.
> This is just a heads-up.
> Before committing it, I will add a rule using something like
> the above to help avoid regressions.
> 
> BTW, there is some very misleading indentation in the vicinity
> of some of these changes, but I didn't correct any of that.

I gave it a once-over and it looks correct to me.

Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]