read_recap: Invert condition (for readability)

This commit is contained in:
Richard Hansen 2024-08-28 02:26:17 -04:00
parent c2db690efb
commit cf54da50e4

View file

@ -1599,25 +1599,24 @@ sub read_recap {
my $config = shift; my $config = shift;
my $globals = {}; my $globals = {};
%{$config} = (); %{$config} = ();
if (-e $file) { return if !(-e $file);
my %saved = %opt; my %saved = %opt;
%opt = (); %opt = ();
$saved_recap = _read_config($config, $globals, "##\\s*$program-$version\\s*", $file); $saved_recap = _read_config($config, $globals, "##\\s*$program-$version\\s*", $file);
%opt = %saved; %opt = %saved;
for my $h (keys(%recap)) { for my $h (keys(%recap)) {
next if !exists($config->{$h}); next if !exists($config->{$h});
# TODO: Why is this limited to this set of variables? Why not copy every recap var # TODO: Why is this limited to this set of variables? Why not copy every recap var defined
# defined for the host's protocol? # for the host's protocol?
for (qw(atime mtime wtime ip ipv4 ipv6 status-ipv4 status-ipv6)) { for (qw(atime mtime wtime ip ipv4 ipv6 status-ipv4 status-ipv6)) {
# TODO: Isn't $config equal to \%recap here? If so, this is a no-op. What was the # TODO: Isn't $config equal to \%recap here? If so, this is a no-op. What was the
# original intention behind this? To copy %recap values into %config? If so, is # original intention behind this? To copy %recap values into %config? If so, is it
# it better to just delete this and live with the current behavior (which doesn't # better to just delete this and live with the current behavior (which doesn't seem to
# seem to be causing users any problems) or to "fix" it to match the original # be causing users any problems) or to "fix" it to match the original intention, which
# intention, which might introduce a bug? # might introduce a bug?
$config->{$h}{$_} = $recap{$h}{$_} if exists $recap{$h}{$_}; $config->{$h}{$_} = $recap{$h}{$_} if exists $recap{$h}{$_};
} }
} }
}
} }
###################################################################### ######################################################################
## parse_assignments(string) return (rest, %variables) ## parse_assignments(string) return (rest, %variables)