Delete unnecessary defined() check

This commit is contained in:
Richard Hansen 2024-07-01 16:12:20 -04:00
parent 478f517d53
commit 5a66efe79e

View file

@ -1959,15 +1959,11 @@ sub init_config {
delete($globals{$k});
next;
}
# TODO: Isn't $globals{$k} guaranteed to be defined here? Otherwise $k wouldn't appear in
# %globals.
my $ovalue = $globals{$k} // $def->{'default'};
# _read_config already checked any value from the config file, so the purpose of this check
# is to validate command-line options which were merged into %globals above.
# TODO: Move this check to where the command-line options are actually processed.
if (!eval { $globals{$k} = check_value($ovalue, $def); 1; }) {
$ovalue //= '(not set)';
warning("ignoring invalid variable value '$k=$ovalue': $@");
if (!eval { $globals{$k} = check_value($globals{$k}, $def); 1; }) {
warning("ignoring invalid variable value '$k=$globals{$k}': $@");
if ($def->{'required'}) {
# TODO: What's the point of this? The opt() function will fall back to the default
# value if $globals{$k} is undefined.