forked from extern/shorewall_code
Eliminate redundant calls to clear_comment.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
fca5b75c5b
commit
4393a6c603
@ -414,8 +414,6 @@ sub setup_accounting() {
|
||||
|
||||
$nonEmpty |= process_accounting_rule while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
|
||||
if ( $nonEmpty ) {
|
||||
my $tableref = $chain_table{$acctable};
|
||||
|
||||
|
@ -1961,8 +1961,8 @@ sub no_comment() {
|
||||
# Clear the $comment variable and the comment stack
|
||||
#
|
||||
sub clear_comment() {
|
||||
$comment = '';
|
||||
@comments = ();
|
||||
$comment = '';
|
||||
@comments = ();
|
||||
}
|
||||
|
||||
#
|
||||
@ -2007,16 +2007,18 @@ sub do_open_file( $ ) {
|
||||
}
|
||||
|
||||
sub open_file( $;$$$ ) {
|
||||
my $fname = find_file $_[0];
|
||||
my ( $fname, $mf, $ca, $nc ) = @_;
|
||||
|
||||
$fname = find_file $fname;
|
||||
|
||||
assert( ! defined $currentfile );
|
||||
|
||||
if ( -f $fname && -s _ ) {
|
||||
$first_entry = 0;
|
||||
$file_format = 1;
|
||||
$max_format = supplied $_[1] ? $_[1] : 1;
|
||||
$comments_allowed = supplied $_[2] ? $_[2] : 0;
|
||||
$nocomment = supplied $_[3] ? $_[3] && no_comment : 0;
|
||||
$max_format = supplied $mf ? $mf : 1;
|
||||
$comments_allowed = supplied $ca ? $ca : 0;
|
||||
$nocomment++ if supplied( $ca ) && no_comment;
|
||||
do_open_file $fname;;
|
||||
} else {
|
||||
$ifstack = @ifstack;
|
||||
@ -2038,10 +2040,12 @@ sub pop_include() {
|
||||
|
||||
if ( $arrayref ) {
|
||||
( $currentfile, $currentfilename, $currentlinenumber, $ifstack, $file_format, $max_format, $nocomment ) = @$arrayref;
|
||||
$comment = '' unless @openstack;
|
||||
} else {
|
||||
$currentfile = undef;
|
||||
$currentlinenumber = 'EOF';
|
||||
$nocomment = $comment = 0;
|
||||
clear_comment;
|
||||
$nocomment = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2960,7 +2964,7 @@ sub read_a_line($) {
|
||||
}
|
||||
|
||||
if ( $comments_allowed && $currentline =~ /^\s*COMMENT\b/ ) {
|
||||
process_comment;
|
||||
process_comment unless $nocomment;
|
||||
$currentline = '';
|
||||
$currentlinenumber = 0;
|
||||
next
|
||||
|
@ -746,8 +746,6 @@ sub process_stoppedrules() {
|
||||
}
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
|
||||
$result;
|
||||
}
|
||||
|
||||
@ -1254,8 +1252,6 @@ sub setup_mac_lists( $ ) {
|
||||
|
||||
progress_message " Maclist entry \"$currentline\" $done";
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
#
|
||||
# Generate jumps from the input and forward chains
|
||||
|
@ -282,8 +282,6 @@ sub setup_masq()
|
||||
first_entry( sub { progress_message2 "$doing $fn..."; require_capability 'NAT_ENABLED' , 'a non-empty masq file' , 's'; } );
|
||||
|
||||
process_one_masq while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,8 +394,6 @@ sub setup_nat() {
|
||||
|
||||
progress_message " NAT entry \"$currentline\" $done";
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
}
|
||||
|
||||
@ -509,8 +505,6 @@ sub setup_netmap() {
|
||||
progress_message " Network $net1 on $iface mapped to $net2 ($type)";
|
||||
}
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -274,8 +274,6 @@ sub setup_conntrack() {
|
||||
}
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
|
||||
if ( $name eq 'notrack') {
|
||||
if ( $empty ) {
|
||||
if ( unlink( $fn ) ) {
|
||||
|
@ -1632,8 +1632,6 @@ sub use_policy_action( $ ) {
|
||||
sub process_macro ($$$$$$$$$$$$$$$$$$$) {
|
||||
my ($macro, $chainref, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
|
||||
|
||||
my $nocomment = no_comment;
|
||||
|
||||
my $generated = 0;
|
||||
|
||||
|
||||
@ -1746,8 +1744,6 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$) {
|
||||
|
||||
progress_message "..End Macro $macrofile";
|
||||
|
||||
clear_comment unless $nocomment;
|
||||
|
||||
return $generated;
|
||||
}
|
||||
|
||||
@ -1757,8 +1753,6 @@ sub process_macro ($$$$$$$$$$$$$$$$$$$) {
|
||||
sub process_inline ($$$$$$$$$$$$$$$$$$$$) {
|
||||
my ($inline, $chainref, $loglevel, $target, $param, $source, $dest, $proto, $ports, $sports, $origdest, $rate, $user, $mark, $connlimit, $time, $headers, $condition, $helper, $wildcard ) = @_;
|
||||
|
||||
my $nocomment = no_comment;
|
||||
|
||||
my $generated = 0;
|
||||
|
||||
my ( $level, $tag ) = split( ':', $loglevel, 2 );
|
||||
@ -1867,8 +1861,6 @@ sub process_inline ($$$$$$$$$$$$$$$$$$$$) {
|
||||
|
||||
pop_action_params( $oldparms );
|
||||
|
||||
clear_comment unless $nocomment;
|
||||
|
||||
return $generated;
|
||||
}
|
||||
|
||||
@ -2737,8 +2729,6 @@ sub process_rules( $ ) {
|
||||
);
|
||||
|
||||
process_rule while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
|
||||
$section = '';
|
||||
@ -2757,8 +2747,6 @@ sub process_rules( $ ) {
|
||||
first_entry "$doing $fn...";
|
||||
|
||||
process_rule while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
|
||||
$section = 'DEFAULTACTION';
|
||||
|
@ -1869,8 +1869,6 @@ sub process_tcpri() {
|
||||
|
||||
process_tc_priority while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
|
||||
if ( $ipp2p ) {
|
||||
insert_irule( $mangle_table->{tcpost} ,
|
||||
j => 'CONNMARK --restore-mark --ctmask ' . in_hex( $globals{TC_MASK} ) ,
|
||||
@ -2394,8 +2392,6 @@ sub setup_tc() {
|
||||
|
||||
process_tc_rule while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
|
||||
}
|
||||
|
||||
if ( my $fn = open_file( 'secmarks', 1, 1 ) ) {
|
||||
@ -2404,7 +2400,6 @@ sub setup_tc() {
|
||||
|
||||
process_secmark_rule while read_a_line( NORMAL_READ );
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
|
||||
handle_stickiness( $sticky );
|
||||
|
@ -298,8 +298,6 @@ sub setup_tunnels() {
|
||||
fatal_error 'ZONE must be specified' if $zone eq '-';
|
||||
setup_one_tunnel $kind, $zone, $gateway, $gatewayzones;
|
||||
}
|
||||
|
||||
clear_comment;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user