[tor-commits] [tor/master] New check-spaces rule: Our C files may not have duplicate names.

nickm at torproject.org nickm at torproject.org
Mon Jun 18 20:17:30 UTC 2018


commit 67dc83fa75e2009b4b6bd5d7f005adcaf45d0c77
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Jun 18 16:17:11 2018 -0400

    New check-spaces rule: Our C files may not have duplicate names.
---
 scripts/maint/checkSpace.pl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/scripts/maint/checkSpace.pl b/scripts/maint/checkSpace.pl
index 4f4ac9b0e..633b47e31 100755
--- a/scripts/maint/checkSpace.pl
+++ b/scripts/maint/checkSpace.pl
@@ -16,12 +16,21 @@ if ($ARGV[0] =~ /^-/) {
     $C = ($lang eq '-C');
 }
 
+our %basenames = ();
+
 for my $fn (@ARGV) {
     open(F, "$fn");
     my $lastnil = 0;
     my $lastline = "";
     my $incomment = 0;
     my $in_func_head = 0;
+    my $basename = $fn;
+    $basename =~ s#.*/##;
+    if ($basenames{$basename}) {
+        msg "Duplicate fnames: $fn and $basenames{$basename}.\n";
+    } else {
+        $basenames{$basename} = $fn;
+    }
     while (<F>) {
         ## Warn about windows-style newlines.
         #    (We insist on lines that end with a single LF character, not



More information about the tor-commits mailing list