[PATCH 9/9] check-spacing: use non-capturing groups

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

 



---
 build-aux/check-spacing.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl
index f66ae10..55687f2 100755
--- a/build-aux/check-spacing.pl
+++ b/build-aux/check-spacing.pl
@@ -43,7 +43,7 @@ foreach my $file (@ARGV) {
         $data =~ s/'[";,=]'/'X'/g;
 
         # Kill any quoted strings
-        $data =~ s,"([^\\\"]|\\.)*","XXX",g;
+        $data =~ s,"(?:[^\\\"]|\\.)*","XXX",g;
 
         # Kill any C++ style comments
         $data =~ s,//.*$,//,;
@@ -91,8 +91,8 @@ foreach my $file (@ARGV) {
             my $kw = $1;
 
             # Allow space after keywords only
-            if ($kw =~ /^(if|for|while|switch|return)$/) {
-                $tmpdata =~ s/($kw\s\()/XXX(/;
+            if ($kw =~ /^(?:if|for|while|switch|return)$/) {
+                $tmpdata =~ s/(?:$kw\s\()/XXX(/;
             } else {
                 print "Whitespace after non-keyword:\n";
                 print "$file:$.: $line";
@@ -102,7 +102,7 @@ foreach my $file (@ARGV) {
         }
 
         # Require whitespace immediately after keywords
-        if ($data =~ /\b(if|for|while|switch|return)\(/) {
+        if ($data =~ /\b(?:if|for|while|switch|return)\(/) {
             print "No whitespace after keyword:\n";
             print "$file:$.: $line";
             $ret = 1;
-- 
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]