src/gray_params.f90: replace misused findloc function

This commit is contained in:
Lorenzo Figini 2024-05-30 18:00:06 +02:00
parent 4f0e06ea71
commit 1bcc4f968b

View File

@ -387,14 +387,14 @@ contains
character(len=max_name_size) :: provided(max_lines), name character(len=max_name_size) :: provided(max_lines), name
! parse the configuration ! parse the configuration
count = 1 count = 0
call parse_ini(filename, ini_handler, err) call parse_ini(filename, ini_handler, err)
if (err /= ERR_SUCCESS) return if (err /= ERR_SUCCESS) return
! check if all mandatory parameters were given ! check if all mandatory parameters were given
do i = 1, size(mandatory) do i = 1, size(mandatory)
name = mandatory(i) name = mandatory(i)
if (findloc(provided, trim(name), count) /= 0) cycle if (any(provided(1:count)==trim(name))) cycle
call log_error('mandatory parameter `'//trim(name)//'` is missing!', & call log_error('mandatory parameter `'//trim(name)//'` is missing!', &
mod='gray_params', proc='read_gray_config') mod='gray_params', proc='read_gray_config')
err = 1 err = 1
@ -415,8 +415,8 @@ contains
err = update_parameter(params, section // "." // name, value) err = update_parameter(params, section // "." // name, value)
! store the parameter name ! store the parameter name
provided(count) = section // "." // name
count = count + 1 count = count + 1
provided(count) = section // "." // name
end function ini_handler end function ini_handler
end subroutine read_gray_config end subroutine read_gray_config