[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Declare all variables to be local



commit f43e56a6d0317d062b23faa8a1835145dbf78fcf
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date:   Thu Dec 15 10:47:48 2016 +0000

    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.
---
 scripts/maint/checkSpace.pl | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

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



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits