From 3ed0624018423bdf91e18429ade3ed3c9f46c69e Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Thu, 30 Oct 2008 22:28:02 +0100 Subject: [PATCH] Configure: Enabled strict mode and localized @cpu. --- ucw/perl/UCW/Configure/C.pm | 15 +++++++++------ ucw/perl/UCW/Configure/LibUCW.pm | 3 +++ ucw/perl/UCW/Configure/Paths.pm | 3 +++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ucw/perl/UCW/Configure/C.pm b/ucw/perl/UCW/Configure/C.pm index eb30caee..ec39630d 100644 --- a/ucw/perl/UCW/Configure/C.pm +++ b/ucw/perl/UCW/Configure/C.pm @@ -8,6 +8,9 @@ package UCW::Configure::C; use UCW::Configure; +use strict; +use warnings; + Test("OS", "Checking on which OS we run", sub { my $os = `uname`; chomp $os; @@ -70,9 +73,9 @@ sub parse_cpuinfo_linux() { } sub parse_cpuinfo_darwin() { - @cpu = (`sysctl -n machdep.cpu.vendor`, - `sysctl -n machdep.cpu.family`, - `sysctl -n machdep.cpu.model`); + my @cpu = (`sysctl -n machdep.cpu.vendor`, + `sysctl -n machdep.cpu.family`, + `sysctl -n machdep.cpu.model`); chomp @cpu; return @cpu; } @@ -250,8 +253,8 @@ sub ConfigHeader($$) { open X, ">obj/$hdr" or Fail $!; print X "/* Generated automatically by $0, please don't touch manually. */\n"; - sub match_rules($) { - my ($name) = @_; + sub match_rules($$) { + my ($rules, $name) = @_; for (my $i=0; $i < scalar @$rules; $i++) { my ($r, $v) = ($rules->[$i], $rules->[$i+1]); return $v if $name =~ $r; @@ -260,7 +263,7 @@ sub ConfigHeader($$) { } foreach my $x (sort keys %UCW::Configure::vars) { - next unless match_rules($x); + next unless match_rules($rules, $x); my $v = $UCW::Configure::vars{$x}; # Try to add quotes if necessary $v = '"' . $v . '"' unless ($v =~ /^"/ || $v =~ /^\d*$/); diff --git a/ucw/perl/UCW/Configure/LibUCW.pm b/ucw/perl/UCW/Configure/LibUCW.pm index ef09fa31..3d17ac7a 100644 --- a/ucw/perl/UCW/Configure/LibUCW.pm +++ b/ucw/perl/UCW/Configure/LibUCW.pm @@ -6,6 +6,9 @@ package UCW::Configure::LibUCW; use UCW::Configure; +use strict; +use warnings; + # Determine page size Test("CPU_PAGE_SIZE", "Determining page size", sub { my $p; diff --git a/ucw/perl/UCW/Configure/Paths.pm b/ucw/perl/UCW/Configure/Paths.pm index ef5c8851..ecfa2caa 100644 --- a/ucw/perl/UCW/Configure/Paths.pm +++ b/ucw/perl/UCW/Configure/Paths.pm @@ -6,6 +6,9 @@ package UCW::Configure::Paths; use UCW::Configure; +use strict; +use warnings; + Log "Determining installation prefix ... "; if (IsSet("CONFIG_LOCAL")) { Log("local build\n"); -- 2.39.5