Просмотр исходного кода

Declare all variables to be local

Without the 'my' keyword the variables are global and Perl requires
global symbols to include an explicit package name.
cypherpunks 10 лет назад
Родитель
Сommit
f43e56a6d0
1 измененных файлов с 8 добавлено и 6 удалено
  1. 8 6
      scripts/maint/checkSpace.pl

+ 8 - 6
scripts/maint/checkSpace.pl

@@ -1,16 +1,18 @@
 #!/usr/bin/perl -w
 #!/usr/bin/perl -w
 
 
+my $C = 0;
+
 if ($ARGV[0] =~ /^-/) {
 if ($ARGV[0] =~ /^-/) {
-    $lang = shift @ARGV;
+    my $lang = shift @ARGV;
     $C = ($lang eq '-C');
     $C = ($lang eq '-C');
-#    $TXT = ($lang eq '-txt');
 }
 }
 
 
-for $fn (@ARGV) {
+for my $fn (@ARGV) {
     open(F, "$fn");
     open(F, "$fn");
-    $lastnil = 0;
-    $lastline = "";
-    $incomment = 0;
+    my $lastnil = 0;
+    my $lastline = "";
+    my $incomment = 0;
+    my $in_func_head = 0;
     while (<F>) {
     while (<F>) {
         ## Warn about windows-style newlines.
         ## Warn about windows-style newlines.
         #    (We insist on lines that end with a single LF character, not
         #    (We insist on lines that end with a single LF character, not