mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-10 23:58:14 +01:00
Implement a filename cache for find_file()
- Don't need to search the CONFIG_PATH for re-open of same file. Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
6ae94767b7
commit
2adec0eb65
@ -673,6 +673,11 @@ our $section_function; #Function Reference for handling ?section
|
|||||||
|
|
||||||
our $evals = 0; # Number of times eval() called out of evaluate_expression() or embedded_perl().
|
our $evals = 0; # Number of times eval() called out of evaluate_expression() or embedded_perl().
|
||||||
|
|
||||||
|
#
|
||||||
|
# Files located via find_file()
|
||||||
|
#
|
||||||
|
our %filecache;
|
||||||
|
|
||||||
sub process_shorewallrc($$);
|
sub process_shorewallrc($$);
|
||||||
sub add_variables( \% );
|
sub add_variables( \% );
|
||||||
#
|
#
|
||||||
@ -1903,6 +1908,10 @@ sub find_file($)
|
|||||||
|
|
||||||
return $filename if $filename =~ '/';
|
return $filename if $filename =~ '/';
|
||||||
|
|
||||||
|
my $file = $filecache{$filename};
|
||||||
|
|
||||||
|
return $file if $file;
|
||||||
|
|
||||||
for my $directory ( @config_path ) {
|
for my $directory ( @config_path ) {
|
||||||
my $file = "$directory$filename";
|
my $file = "$directory$filename";
|
||||||
return $file if -f $file;
|
return $file if -f $file;
|
||||||
|
Loading…
Reference in New Issue
Block a user