From 3483e8052a33993739dc8cd3889c5baf43cdeb9c Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Tue, 16 Jun 2009 15:52:38 -0700 Subject: [PATCH] Small optimization in lookup_provider() --- Shorewall/Perl/Shorewall/Providers.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Providers.pm b/Shorewall/Perl/Shorewall/Providers.pm index a81019d9b..42d964449 100644 --- a/Shorewall/Perl/Shorewall/Providers.pm +++ b/Shorewall/Perl/Shorewall/Providers.pm @@ -769,11 +769,8 @@ sub lookup_provider( $ ) { my $provider_number = numeric_value $provider; - for ( keys %providers ) { - if ( $providers{$_}{number} == $provider_number ) { - $providerref = $providers{$_}; - last; - } + for ( values %providers ) { + $providerref = $_, last if $_->{number} == $provider_number; } fatal_error "Unknown provider ($provider)" unless $providerref;