[libvirt] [PATCH] syntax-check: ignore all quoted strings in bracket-spacing

Eric Blake eblake at redhat.com
Fri May 24 13:53:55 UTC 2013


On 05/24/2013 03:26 AM, Ján Tomko wrote:
> Ignore strings with an escaped double quote too.
> 
> This removes the need for special handling of quotes in the
> semicolon check.
> ---
>  build-aux/bracket-spacing.pl | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/build-aux/bracket-spacing.pl b/build-aux/bracket-spacing.pl
> index fbe6666..a99edeb 100755
> --- a/build-aux/bracket-spacing.pl
> +++ b/build-aux/bracket-spacing.pl
> @@ -31,8 +31,8 @@ foreach my $file (@ARGV) {
>      while (defined (my $line = <FILE>)) {
>          my $data = $line;
>  
> -        # Kill any quoted strongs
> -        $data =~ s,".*?","XXX",g;
> +        # Kill any quoted strings
> +        $data =~ s,"([^\\\"]|\\.)+","XXX",g;

Nice.  I've used that trick in cfg.mk as well.

You used '+' instead of '*'; that gives us a chance of a false positive,
if we have both an empty string and another string on the same line:

    str = cond ? "" : " ; ";

because your replacement would result in a rewrite to:

    str = cond ? ""XXX" ; ";

With *, the rewrite would be:

    str = cond ? "XXX" : "XXX";

ACK if you fix the regex.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130524/dce21363/attachment-0001.sig>


More information about the libvir-list mailing list