Commit a208868fc0a90f62a91893b0193459de957c8d8e

Authored by Stephen Hemminger
Committed by Michal Marek
1 parent 3da2715731

checkversion: perl cleanup

Turn on strict checking.
Use three arguement open
Standard practice in perl is to use undef not zero for false

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>

Showing 1 changed file with 11 additions and 12 deletions Side-by-side Diff

scripts/checkversion.pl
... ... @@ -5,23 +5,22 @@
5 5 # including <linux/version.h> that don't need it.
6 6 # Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net>
7 7  
  8 +use strict;
  9 +
8 10 $| = 1;
9 11  
10   -my $debugging = 0;
  12 +my $debugging;
11 13  
12   -foreach $file (@ARGV)
13   -{
  14 +foreach my $file (@ARGV) {
14 15 # Open this file.
15   - open(FILE, $file) || die "Can't open $file: $!\n";
  16 + open( my $f, '<', $file )
  17 + or die "Can't open $file: $!\n";
16 18  
17 19 # Initialize variables.
18   - my $fInComment = 0;
19   - my $fInString = 0;
20   - my $fUseVersion = 0;
  20 + my ($fInComment, $fInString, $fUseVersion);
21 21 my $iLinuxVersion = 0;
22 22  
23   - LINE: while ( <FILE> )
24   - {
  23 + while (<$f>) {
25 24 # Strip comments.
26 25 $fInComment && (s+^.*?\*/+ +o ? ($fInComment = 0) : next);
27 26 m+/\*+o && (s+/\*.*?\*/+ +go, (s+/\*.*$+ +o && ($fInComment = 1)));
... ... @@ -43,8 +42,8 @@
43 42 # Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE
44 43 if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/)) {
45 44 $fUseVersion = 1;
46   - last LINE if $iLinuxVersion;
47   - }
  45 + last if $iLinuxVersion;
  46 + }
48 47 }
49 48  
50 49 # Report used version IDs without include?
... ... @@ -67,6 +66,6 @@
67 66 }
68 67 }
69 68  
70   - close(FILE);
  69 + close($f);
71 70 }