From 36143a0c55b8cfba5c5c2c2b40c5e00bce067bf2 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 27 Feb 2012 17:57:54 +0100 Subject: 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(). --- regen/feature.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'regen') 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 { -- cgit v1.2.1