From 8f47e47efa8d0850dca4d17f30c15aafda130481 Mon Sep 17 00:00:00 2001 From: teastep Date: Fri, 28 Mar 2008 01:47:40 +0000 Subject: [PATCH] Clean up RFC 1918 change git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@8373 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/Shorewall/Actions.pm | 10 +++++----- Shorewall-perl/Shorewall/Config.pm | 5 +---- Shorewall-perl/Shorewall/Rules.pm | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Shorewall-perl/Shorewall/Actions.pm b/Shorewall-perl/Shorewall/Actions.pm index b428a9185..f8f2b765c 100644 --- a/Shorewall-perl/Shorewall/Actions.pm +++ b/Shorewall-perl/Shorewall/Actions.pm @@ -53,7 +53,7 @@ our @EXPORT = qw( merge_levels %actions %macros - %macro_commands + $macro_commands ); our @EXPORT_OK = qw( initialize ); our $VERSION = 4.1.1; @@ -86,7 +86,7 @@ our %macros; # # Commands that can be embedded in a macro file and how many total tokens on the line (0 => unlimited). # -our %macro_commands = ( COMMENT => 0, FORMAT => 2 ); +our $macro_commands = { COMMENT => 0, FORMAT => 2 }; # # Initialize globals -- we take this novel approach to globals initialization to allow @@ -407,7 +407,7 @@ sub process_macro1 ( $$ ) { push_open( $macrofile ); while ( read_a_line ) { - my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ) = split_line1 1, 9, 'macro file', \%macro_commands; + my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ) = split_line1 1, 9, 'macro file', $macro_commands; next if $mtarget eq 'COMMENT' || $mtarget eq 'FORMAT'; @@ -597,9 +597,9 @@ sub process_macro3( $$$$$$$$$$$ ) { my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ); if ( $format == 1 ) { - ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser, $morigdest ) = split_line1 1, 9, 'macro file', \%macro_commands; + ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser, $morigdest ) = split_line1 1, 9, 'macro file', $macro_commands; } else { - ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ) = split_line1 1, 9, 'macro file', \%macro_commands; + ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ) = split_line1 1, 9, 'macro file', $macro_commands; } if ( $mtarget eq 'COMMENT' ) { diff --git a/Shorewall-perl/Shorewall/Config.pm b/Shorewall-perl/Shorewall/Config.pm index f6a9d4245..9ed08cab1 100644 --- a/Shorewall-perl/Shorewall/Config.pm +++ b/Shorewall-perl/Shorewall/Config.pm @@ -934,10 +934,7 @@ sub split_line1( $$$;$ ) { my $columns = $nopad->{$first}; if ( defined $columns ) { - if ( $columns ) { - fatal_error "Invalid $first entry" if @line != $columns; - } - + fatal_error "Invalid $first entry" if $columns && @line != $columns; return @line } diff --git a/Shorewall-perl/Shorewall/Rules.pm b/Shorewall-perl/Shorewall/Rules.pm index 6fbed1b22..cbfe9e86e 100644 --- a/Shorewall-perl/Shorewall/Rules.pm +++ b/Shorewall-perl/Shorewall/Rules.pm @@ -857,9 +857,9 @@ sub process_macro ( $$$$$$$$$$$$$ ) { my ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ); if ( $format == 1 ) { - ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser, $morigdest ) = split_line1 1, 9, 'macro file', \%macro_commands; + ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $mrate, $muser, $morigdest ) = split_line1 1, 9, 'macro file', $macro_commands; } else { - ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ) = split_line1 1, 9, 'macro file', \%macro_commands; + ( $mtarget, $msource, $mdest, $mproto, $mports, $msports, $morigdest, $mrate, $muser ) = split_line1 1, 9, 'macro file', $macro_commands; } if ( $mtarget eq 'COMMENT' ) {