[PATCH 5/9] check-spacing: rewrite whitespace check before (semi)colon

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

 



Instead of matching multiple characters, match any occurrence
preceded by a single whitespace and handle the exceptions
later.
---
 build-aux/check-spacing.pl | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl
index 83b5898..d693fbe 100755
--- a/build-aux/check-spacing.pl
+++ b/build-aux/check-spacing.pl
@@ -135,10 +135,13 @@ foreach my $file (@ARGV) {
         #          errno == EINTR)
         #       ;
         #
-        if ($data =~ /[^;\s]\s+[;,]/) {
-            print "Whitespace before (semi)colon:\n";
-            print "$file:$.: $line";
-            $ret = 1;
+        if ($data =~ /\s[;,]/) {
+            unless ($data =~ /\S; ; / ||
+                    $data =~ /^\s+;/) {
+                print "Whitespace before (semi)colon:\n";
+                print "$file:$.: $line";
+                $ret = 1;
+            }
         }
 
         # Require EOL, macro line continuation, or whitespace after ";".
-- 
2.7.3

--
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]