summaryrefslogtreecommitdiff
path: root/makedef.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-07-28 15:05:26 +0200
committerNicholas Clark <nick@ccl4.org>2011-08-01 11:53:57 +0200
commit29200a82a647b7edaead2daef398fbce178fb7c7 (patch)
tree4a662a2ee9d84d9bb355b4b341be910edccd2599 /makedef.pl
parent0dc3711c7435529d221445ddb0c229ce2750445f (diff)
downloadperl-29200a82a647b7edaead2daef398fbce178fb7c7.tar.gz
In makedef.pl, avoid creating %PLATFORMS just for one existence check.
A single linear search of @PLATFORMS is simpler and possibly even faster than building a hash from @PLATFORMS, making one lookup, then discarding the hash. Add a block to limit the scope of @PLATFORMS to the code that uses it.
Diffstat (limited to 'makedef.pl')
-rw-r--r--makedef.pl18
1 files changed, 10 insertions, 8 deletions
diff --git a/makedef.pl b/makedef.pl
index 42ca3950b2..0a97ba174c 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -54,14 +54,16 @@ while (@ARGV) {
}
}
-my @PLATFORM = qw(aix win32 wince os2 netware vms);
-my %PLATFORM;
-@PLATFORM{@PLATFORM} = ();
-
-die "PLATFORM undefined, must be one of: @PLATFORM\n"
- unless defined $ARGS{PLATFORM};
-die "PLATFORM must be one of: @PLATFORM\n"
- unless exists $PLATFORM{$ARGS{PLATFORM}};
+{
+ my @PLATFORM = qw(aix win32 wince os2 netware vms);
+ my %PLATFORM;
+ @PLATFORM{@PLATFORM} = ();
+
+ die "PLATFORM undefined, must be one of: @PLATFORM\n"
+ unless defined $ARGS{PLATFORM};
+ die "PLATFORM must be one of: @PLATFORM\n"
+ unless exists $PLATFORM{$ARGS{PLATFORM}};
+}
# Is the following guard strictly necessary? Added during refactoring
# to keep the same behaviour when merging other code into here.