diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-01-10 08:31:35 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-02-06 14:33:05 -0500 |
commit | bfa760738521715f8c858de7584fd08cd90cb538 (patch) | |
tree | 68647b9d68ce11e302530f082bcfd662cd15479d /scripts/maint/checkSpace.pl | |
parent | 1f1d943999bd0ade5153074bb90ee9a40440825f (diff) | |
download | tor-bfa760738521715f8c858de7584fd08cd90cb538.tar.gz tor-bfa760738521715f8c858de7584fd08cd90cb538.zip |
checkSpace.pl: Use a data structure for a list of non-function names
Diffstat (limited to 'scripts/maint/checkSpace.pl')
-rwxr-xr-x | scripts/maint/checkSpace.pl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl index 3080fafd3e..cc77d8d5be 100755 --- a/scripts/maint/checkSpace.pl +++ b/scripts/maint/checkSpace.pl @@ -23,6 +23,12 @@ if ($ARGV[0] =~ /^-/) { $C = ($lang eq '-C'); } +# hashmap of things where we allow spaces between them and (. +our %allow_space_after= map {$_, 1} qw{ + if while for switch return int unsigned elsif WINAPI + void __attribute__ op size_t double uint64_t workqueue_reply_t bool +}; + our %basenames = (); our %guardnames = (); @@ -177,12 +183,7 @@ for my $fn (@ARGV) { # (Don't put a space between the name of a function and its # arguments.) if (/(\w+)\s\(([A-Z]*)/) { - if ($1 ne "if" and $1 ne "while" and $1 ne "for" and - $1 ne "switch" and $1 ne "return" and $1 ne "int" and - $1 ne "elsif" and $1 ne "WINAPI" and $2 ne "WINAPI" and - $1 ne "void" and $1 ne "__attribute__" and $1 ne "op" and - $1 ne "size_t" and $1 ne "double" and $1 ne "uint64_t" and - $1 ne "workqueue_reply_t" and $1 ne "bool") { + if (! $allow_space_after{$1} && $2 ne 'WINAPI') { msg "fn ():$fn:$.\n"; } } |