mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
bracket-spacing: Remove pointless cycles
Change while () { smth; last; } to if () { smth; } as 'last' in perl is analogous to 'break' in C. These are probably copy-paste leftovers from creating new syntax-check rules. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
d697de90c0
commit
5e1af759cf
@ -97,26 +97,23 @@ foreach my $file (@ARGV) {
|
|||||||
|
|
||||||
# Require whitespace immediately after keywords,
|
# Require whitespace immediately after keywords,
|
||||||
# but none after the opening bracket
|
# but none after the opening bracket
|
||||||
while ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
if ($data =~ /\b(if|for|while|switch|return)\(/ ||
|
||||||
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
$data =~ /\b(if|for|while|switch|return)\s+\(\s/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Forbid whitespace between )( of a function typedef
|
# Forbid whitespace between )( of a function typedef
|
||||||
while ($data =~ /\(\*\w+\)\s+\(/) {
|
if ($data =~ /\(\*\w+\)\s+\(/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Forbid whitespace following ( or prior to )
|
# Forbid whitespace following ( or prior to )
|
||||||
while ($data =~ /\S\s+\)/ ||
|
if ($data =~ /\S\s+\)/ ||
|
||||||
$data =~ /\(\s+\S/) {
|
$data =~ /\(\s+\S/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Forbid whitespace before ";" or ",". Things like below are allowed:
|
# Forbid whitespace before ";" or ",". Things like below are allowed:
|
||||||
@ -129,36 +126,32 @@ foreach my $file (@ARGV) {
|
|||||||
# errno == EINTR)
|
# errno == EINTR)
|
||||||
# ;
|
# ;
|
||||||
#
|
#
|
||||||
while ($data =~ /[^;\s]\s+[;,]/) {
|
if ($data =~ /[^;\s]\s+[;,]/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Require EOL, macro line continuation, or whitespace after ";".
|
# Require EOL, macro line continuation, or whitespace after ";".
|
||||||
# Allow "for (;;)" as an exception.
|
# Allow "for (;;)" as an exception.
|
||||||
while ($data =~ /;[^ \\\n;)]/) {
|
if ($data =~ /;[^ \\\n;)]/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Require EOL, space, or enum/struct end after comma.
|
# Require EOL, space, or enum/struct end after comma.
|
||||||
while ($data =~ /,[^ \\\n)}]/) {
|
if ($data =~ /,[^ \\\n)}]/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Require spaces around assignment '=', compounds and '=='
|
# Require spaces around assignment '=', compounds and '=='
|
||||||
# with the exception of virAssertCmpInt()
|
# with the exception of virAssertCmpInt()
|
||||||
$tmpdata = $data;
|
$tmpdata = $data;
|
||||||
$tmpdata =~ s/(virAssertCmpInt\(.* ).?=,/$1op,/;
|
$tmpdata =~ s/(virAssertCmpInt\(.* ).?=,/$1op,/;
|
||||||
while ($tmpdata =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/ ||
|
if ($tmpdata =~ /[^ ]\b[!<>&|\-+*\/%\^=]?=[^=]/ ||
|
||||||
$tmpdata =~ /=[^= \\\n]/) {
|
$tmpdata =~ /=[^= \\\n]/) {
|
||||||
print "$file:$.: $line";
|
print "$file:$.: $line";
|
||||||
$ret = 1;
|
$ret = 1;
|
||||||
last;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close FILE;
|
close FILE;
|
||||||
|
Loading…
Reference in New Issue
Block a user