Silence warnings/errors from uninitialized variables

This commit is contained in:
Eric Miller
2008-07-29 03:23:35 +00:00
parent 6a1f6d43cf
commit 1eff8f8224
5 changed files with 18 additions and 19 deletions

View File

@@ -214,7 +214,7 @@ sub i_speed_admin {
my $partial = shift; my $partial = shift;
my %i_speed_admin; my %i_speed_admin;
my $p_port = $stack->p_port(); my $p_port = $stack->p_port() || {};
my %mapping = reverse %$p_port; my %mapping = reverse %$p_port;
my $p_speed = $stack->p_speed( $mapping{$partial} ); my $p_speed = $stack->p_speed( $mapping{$partial} );

View File

@@ -284,7 +284,7 @@ sub set_i_up_admin {
my $bayhub = shift; my $bayhub = shift;
my ( $setting, $iid ) = @_; my ( $setting, $iid ) = @_;
my $i_index = $bayhub->i_index(); my $i_index = $bayhub->i_index() || {};
my %reverse_i_index = reverse %$i_index; my %reverse_i_index = reverse %$i_index;
$setting = lc($setting); $setting = lc($setting);

View File

@@ -95,7 +95,7 @@ sub i_duplex {
my $partial = shift; my $partial = shift;
my $interfaces = $c2900->interfaces($partial); my $interfaces = $c2900->interfaces($partial);
my $c2900_p_index = $c2900->c2900_p_index(); my $c2900_p_index = $c2900->c2900_p_index() || {};
my $c2900_p_duplex = $c2900->c2900_p_duplex(); my $c2900_p_duplex = $c2900->c2900_p_duplex();
my %reverse_2900 = reverse %$c2900_p_index; my %reverse_2900 = reverse %$c2900_p_index;
@@ -119,7 +119,7 @@ sub i_duplex_admin {
my $partial = shift; my $partial = shift;
my $interfaces = $c2900->interfaces($partial); my $interfaces = $c2900->interfaces($partial);
my $c2900_p_index = $c2900->c2900_p_index(); my $c2900_p_index = $c2900->c2900_p_index() || {};
my $c2900_p_admin = $c2900->c2900_p_duplex_admin(); my $c2900_p_admin = $c2900->c2900_p_duplex_admin();
my %reverse_2900 = reverse %$c2900_p_index; my %reverse_2900 = reverse %$c2900_p_index;
@@ -146,7 +146,7 @@ sub set_i_speed_admin {
# map speeds to those the switch will understand # map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000/; my %speeds = qw/auto 1 10 10000000 100 100000000/;
my $c2900_p_index = $c2900->c2900_p_index(); my $c2900_p_index = $c2900->c2900_p_index() || {};
my %reverse_2900 = reverse %$c2900_p_index; my %reverse_2900 = reverse %$c2900_p_index;
$speed = lc($speed); $speed = lc($speed);
@@ -166,7 +166,7 @@ sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands # map a textual duplex to an integer one the switch understands
my %duplexes = qw/full 1 half 2 auto 3/; my %duplexes = qw/full 1 half 2 auto 3/;
my $c2900_p_index = $c2900->c2900_p_index(); my $c2900_p_index = $c2900->c2900_p_index() || {};
my %reverse_2900 = reverse %$c2900_p_index; my %reverse_2900 = reverse %$c2900_p_index;
$duplex = lc($duplex); $duplex = lc($duplex);

View File

@@ -188,7 +188,7 @@ sub interfaces {
) )
) )
{ {
$vlan_index = $passport->rc_vlan_if(); $vlan_index = $passport->rc_vlan_if() || {};
%reverse_vlan = reverse %$vlan_index; %reverse_vlan = reverse %$vlan_index;
$vlan_id = $passport->rc_vlan_id(); $vlan_id = $passport->rc_vlan_id();
} }

View File

@@ -170,16 +170,15 @@ sub mau_i_duplex_admin {
my $mau = shift; my $mau = shift;
my $partial = shift; my $partial = shift;
my $mau_index = $mau->mau_index(); my $mau_index = $mau->mau_index() || {};
if ($partial) {
my %rev_mau_index = reverse %$mau_index; my %rev_mau_index = reverse %$mau_index;
my $mau_autostat $partial = $rev_mau_index{$partial};
= defined $partial }
? $mau->mau_autostat( $rev_mau_index{$partial} )
: $mau->mau_autostat(); my $mau_autostat = $mau->mau_autostat($partial) || {};
my $mau_type_admin my $mau_type_admin = $mau->mau_type_admin($partial) || {};
= defined $partial
? $mau->mau_type_admin( $rev_mau_index{$partial} )
: $mau->mau_type_admin();
# Older HP4000's don't implement ifMauDefaultType, but we can # Older HP4000's don't implement ifMauDefaultType, but we can
# figure out from ifMauAutoNegCapAdvertised what we'd like. # figure out from ifMauAutoNegCapAdvertised what we'd like.