From cdf84bf1a80148e4a4e62d113b82863df8bddfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 14 Jun 2016 18:27:24 +0200 Subject: [PATCH] check-spacing: rewrite regex for checking the closing parenthesis Instead of matching multiple characters before the parenthesis, only check for a single whitespace, which is much less cpu-intensive. This only matches a few dozen of places where they are on an separate line, filter out those with a separate regex. --- build-aux/check-spacing.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index d693fbe572..7c5bbf9e51 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -118,7 +118,9 @@ foreach my $file (@ARGV) { } # Forbid whitespace following ( or prior to ) - if ($data =~ /\S\s+\)/ || + # but allow whitespace before ) on a single line + # (optionally followed by a semicolon) + if (($data =~ /\s\)/ && not $data =~ /^\s+\);?$/) || $data =~ /\(\s+\S/) { print "Whitespace after '(' or before ')':\n"; print "$file:$.: $line";