Eliminate @comments

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-12-25 17:00:24 -08:00
parent 3f28af80d2
commit 84cc78c58e
3 changed files with 15 additions and 26 deletions

View File

@ -2330,7 +2330,7 @@ sub ensure_audit_blacklog_chain( $$$ ) {
sub ensure_audit_chain( $;$$ ) {
my ( $target, $action, $tgt ) = @_;
push_comment( '' );
my $save_comment = push_comment;
my $ref = $filter_table->{$target};
@ -2353,7 +2353,7 @@ sub ensure_audit_chain( $;$$ ) {
}
}
pop_comment;
pop_comment( $save_comment );
return $target;
}

View File

@ -135,7 +135,6 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
process_comment
no_comment
macro_comment
clear_comment
push_comment
pop_comment
dump_mark_layout
@ -495,7 +494,6 @@ our $first_entry; # Message to output or function to call on first no
our $file_format; # Format of configuration file.
our $max_format; # Max format value
our $comment; # Current COMMENT
our @comments;
our $comments_allowed;
our $nocomment;
our $warningcount;
@ -623,7 +621,6 @@ sub initialize( $;$$) {
# Contents of last COMMENT line.
#
$comment = '';
@comments = ();
$warningcount = 0;
$warningcount1 = 0;
$warningcount2 = 0;
@ -1962,26 +1959,20 @@ sub no_comment() {
#
sub clear_comment() {
$comment = '';
@comments = ();
$nocomment = 0;
}
#
# Push and Pop comment stack
#
sub push_comment( $ ) {
push @comments, $comment;
$comment = shift;
sub push_comment() {
my $return = $comment;
$comment = '';
$return;
}
sub pop_comment() {
$comment = pop @comments;
}
#
# Set comment
#
sub set_comment( $ ) {
$comment = shift;
sub pop_comment( $ ) {
$comment = $_[0];
}
#
@ -2073,7 +2064,6 @@ sub pop_include() {
$currentfile = undef;
$currentlinenumber = 'EOF';
clear_comment;
$nocomment = 0;
}
}

View File

@ -842,8 +842,7 @@ sub finish_chain_section ($$) {
my $chain = $chainref->{name};
my $related_level = $config{RELATED_LOG_LEVEL};
my $related_target = $globals{RELATED_TARGET};
push_comment(''); #These rules should not have comments
my $save_comment = push_comment;
if ( $state =~ /RELATED/ && ( $related_level || $related_target ne 'ACCEPT' ) ) {
@ -890,7 +889,7 @@ sub finish_chain_section ($$) {
$chainref->{new} = @{$chainref->{rules}};
}
pop_comment;
pop_comment( $save_comment );
}
#
@ -1561,7 +1560,7 @@ sub process_action($) {
$active{$action}++;
push @actionstack, $wholeaction;
push_comment( '' );
my $save_comment = push_comment;
while ( read_a_line( NORMAL_READ ) ) {
@ -1603,7 +1602,7 @@ sub process_action($) {
0 );
}
pop_comment;
pop_comment( $save_comment );
$active{$action}--;
pop @actionstack;
@ -1769,7 +1768,7 @@ sub process_inline ($$$$$$$$$$$$$$$$$$$$) {
push_open $inlinefile, 2, 1;
push_comment('');
my $save_comment = push_comment;
while ( read_a_line( NORMAL_READ ) ) {
my ( $mtarget,
@ -1855,7 +1854,7 @@ sub process_inline ($$$$$$$$$$$$$$$$$$$$) {
progress_message " Rule \"$currentline\" $done";
}
pop_comment;
pop_comment( $save_comment );
pop_open;