mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-17 03:40:53 +01:00
Use optimized 'split' to reduce compilation CPU utilization
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6731 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
0a06ba5275
commit
f10e9e42d5
@ -325,6 +325,7 @@ INIT {
|
|||||||
sub process_comment() {
|
sub process_comment() {
|
||||||
if ( $capabilities{COMMENTS} ) {
|
if ( $capabilities{COMMENTS} ) {
|
||||||
( $comment = $line ) =~ s/^\s*COMMENT\s*//;
|
( $comment = $line ) =~ s/^\s*COMMENT\s*//;
|
||||||
|
$comment =~ s/\s*$//;
|
||||||
} else {
|
} else {
|
||||||
warning_message "COMMENT ignored -- requires comment support in iptables/Netfilter";
|
warning_message "COMMENT ignored -- requires comment support in iptables/Netfilter";
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ sub split_line( $$$ ) {
|
|||||||
|
|
||||||
fatal_error "Shorewall Configuration file entries may not contain single quotes, double quotes, single back quotes or backslashes" if $line =~ /["'`\\]/;
|
fatal_error "Shorewall Configuration file entries may not contain single quotes, double quotes, single back quotes or backslashes" if $line =~ /["'`\\]/;
|
||||||
|
|
||||||
my @line = split( /\s+/, $line, $maxcolumns + 1 );
|
my @line = split( ' ', $line );
|
||||||
|
|
||||||
fatal_error "Invalid $description entry (too few columns)" if @line < $mincolumns;
|
fatal_error "Invalid $description entry (too few columns)" if @line < $mincolumns;
|
||||||
fatal_error "Invalid $description entry (too many columns)" if @line > $maxcolumns;
|
fatal_error "Invalid $description entry (too many columns)" if @line > $maxcolumns;
|
||||||
@ -402,7 +402,7 @@ sub split_line1( $$$ ) {
|
|||||||
|
|
||||||
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $line =~ /["`\\]/;
|
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $line =~ /["`\\]/;
|
||||||
|
|
||||||
my @line = split( /\s+/, $line, $maxcolumns + 1);
|
my @line = split( ' ', $line );
|
||||||
|
|
||||||
return @line if $line[0] eq 'COMMENT';
|
return @line if $line[0] eq 'COMMENT';
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ sub split_line2( $$$ ) {
|
|||||||
|
|
||||||
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $line =~ /["`\\]/;
|
fatal_error "Shorewall Configuration file entries may not contain double quotes, single back quotes or backslashes" if $line =~ /["`\\]/;
|
||||||
|
|
||||||
my @line = split( /\s+/, $line, $maxcolumns + 1 );
|
my @line = split( ' ', $line );
|
||||||
|
|
||||||
my $first = $line[0];
|
my $first = $line[0];
|
||||||
my $columns = $no_pad{$first};
|
my $columns = $no_pad{$first};
|
||||||
@ -554,9 +554,6 @@ sub read_a_line {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
$line =~ s/^\s+//; # Remove Leading white space
|
|
||||||
$line =~ s/\s+$//; # Remove Trailing white space
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Expand Shell Variables using %ENV
|
# Expand Shell Variables using %ENV
|
||||||
#
|
#
|
||||||
@ -565,7 +562,7 @@ sub read_a_line {
|
|||||||
|
|
||||||
if ( $line =~ /^INCLUDE\s/ ) {
|
if ( $line =~ /^INCLUDE\s/ ) {
|
||||||
|
|
||||||
my @line = split /\s+/, $line, 3;
|
my @line = split ' ', $line, 3;
|
||||||
|
|
||||||
fatal_error "Invalid INCLUDE command: $line" if @line != 2;
|
fatal_error "Invalid INCLUDE command: $line" if @line != 2;
|
||||||
fatal_error "INCLUDEs nested too deeply: $line" if @includestack >= 4;
|
fatal_error "INCLUDEs nested too deeply: $line" if @includestack >= 4;
|
||||||
@ -600,10 +597,7 @@ sub read_a_line1 {
|
|||||||
next if $line =~ /^\s*#/;
|
next if $line =~ /^\s*#/;
|
||||||
chomp $line;
|
chomp $line;
|
||||||
next if $line =~ /^\s*$/;
|
next if $line =~ /^\s*$/;
|
||||||
$line =~ s/#.*$//; # Remove Trailing Comments -- result might be a blank line
|
$line =~ s/#.*$//; # Remove Trailing Comments
|
||||||
$line =~ s/^\s+//; # Remove Leading white space
|
|
||||||
$line =~ s/\s+$//; # Remove Trailing white space
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user