From 45fffc7261c41925b324185c7743baf49a826269 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 22 Jul 2009 10:43:53 -0700 Subject: [PATCH] Replace 'edit' by 'validate' in compiler parameter handling logic --- Shorewall/Perl/Shorewall/Compiler.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index eddc3d79e..70163e21c 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -541,31 +541,31 @@ sub compiler { $export = 0; $test = 0; - sub edit_boolean( $ ) { + sub validate_boolean( $ ) { my $val = numeric_value( shift ); defined($val) && ($val >= 0) && ($val < 2); } - sub edit_verbosity( $ ) { + sub validate_verbosity( $ ) { my $val = numeric_value( shift ); defined($val) && ($val >= MIN_VERBOSITY) && ($val <= MAX_VERBOSITY); } - sub edit_family( $ ) { + sub validate_family( $ ) { my $val = numeric_value( shift ); defined($val) && ($val == F_IPV4 || $val == F_IPV6); } my %parms = ( object => { store => \$objectfile }, directory => { store => \$directory }, - family => { store => \$family , edit => \&edit_family } , - verbosity => { store => \$verbosity , edit => \&edit_verbosity } , - timestamp => { store => \$timestamp, edit => \&edit_boolean } , - debug => { store => \$debug, edit => \&edit_boolean } , - export => { store => \$export , edit => \&edit_boolean } , + family => { store => \$family , validate => \&validate_family } , + verbosity => { store => \$verbosity , validate => \&validate_verbosity } , + timestamp => { store => \$timestamp, validate => \&validate_boolean } , + debug => { store => \$debug, validate => \&validate_boolean } , + export => { store => \$export , validate => \&validate_boolean } , chains => { store => \$chains }, log => { store => \$log }, - log_verbosity => { store => \$log_verbosity, edit => \&edit_verbosity } , + log_verbosity => { store => \$log_verbosity, validate => \&validate_verbosity } , test => { store => \$test }, ); # @@ -574,8 +574,8 @@ sub compiler { while ( defined ( my $name = shift ) ) { fatal_error "Unknown parameter ($name)" unless my $ref = $parms{$name}; fatal_error "Undefined value supplied for parameter $name" unless defined ( my $val = shift ) ; - if ( $ref->{edit} ) { - fatal_error "Invalid value ( $val ) supplied for parameter $name" unless $ref->{edit}->($val); + if ( $ref->{validate} ) { + fatal_error "Invalid value ( $val ) supplied for parameter $name" unless $ref->{validate}->($val); } ${$ref->{store}} = $val;