summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-02-27 17:57:54 +0100
committerNicholas Clark <nick@ccl4.org>2012-03-19 10:21:54 +0100
commit36143a0c55b8cfba5c5c2c2b40c5e00bce067bf2 (patch)
tree9d5f9273723384f7d067ebd844c4e98c2b400c28 /regen
parent1873980aaeb3ef1e5a2e1ef646a831ce8ddc3e11 (diff)
downloadperl-36143a0c55b8cfba5c5c2c2b40c5e00bce067bf2.tar.gz
In feature.pm, use a consistent code style in import() and unimport().
There were a couple of inconsistencies (shift with/without an explicit @_, exists with/without(), !@_ vs @_ == 0) which turn out to date back to before 5.10.0 Also fix an inadvertent use of a single element array slice with a simple array lookup in current_bundle().
Diffstat (limited to 'regen')
-rwxr-xr-xregen/feature.pl11
1 files changed, 6 insertions, 5 deletions
diff --git a/regen/feature.pl b/regen/feature.pl
index aaac912ca2..6d276ce511 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -586,7 +586,7 @@ bundle is automatically loaded instead.
sub current_bundle {
my $bundle_number = $^H & $hint_mask;
return if $bundle_number == $hint_mask;
- return $feature_bundle{@hint_bundles[$bundle_number >> $hint_shift]};
+ return $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]};
}
sub normalise_hints {
@@ -601,15 +601,17 @@ sub normalise_hints {
sub import {
my $class = shift;
- if (@_ == 0) {
+
+ if (!@_) {
croak("No features specified");
}
+
if (my $features = current_bundle) {
# Features are enabled implicitly via bundle hints.
normalise_hints $features;
}
while (@_) {
- my $name = shift(@_);
+ my $name = shift;
if (substr($name, 0, 1) eq ":") {
my $v = substr($name, 1);
if (!exists $feature_bundle{$v}) {
@@ -642,7 +644,6 @@ sub unimport {
# Features are enabled implicitly via bundle hints.
normalise_hints $features;
}
-
while (@_) {
my $name = shift;
if (substr($name, 0, 1) eq ":") {
@@ -656,7 +657,7 @@ sub unimport {
unshift @_, @{$feature_bundle{$v}};
next;
}
- if (!exists($feature{$name})) {
+ if (!exists $feature{$name}) {
unknown_feature($name);
}
else {