Skip to content

Commit 3c83669

Browse files
committed
removed some unnecessary checks.
1 parent 1293b13 commit 3c83669

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

src/json_value_module.F90

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8052,20 +8052,14 @@ function string_to_int(json,str) result(ival)
80528052

80538053
logical(LK) :: status_ok !! error flag for [[string_to_integer]]
80548054

8055-
if (.not. json%exception_thrown) then
8056-
8057-
! call the core routine:
8058-
call string_to_integer(str,ival,status_ok)
8059-
8060-
if (.not. status_ok) then
8061-
ival = 0
8062-
call json%throw_exception('Error in string_to_int: '//&
8063-
'string cannot be converted to an integer: '//&
8064-
trim(str))
8065-
end if
8055+
! call the core routine:
8056+
call string_to_integer(str,ival,status_ok)
80668057

8067-
else
8058+
if (.not. status_ok) then
80688059
ival = 0
8060+
call json%throw_exception('Error in string_to_int: '//&
8061+
'string cannot be converted to an integer: '//&
8062+
trim(str))
80698063
end if
80708064

80718065
end function string_to_int
@@ -8085,19 +8079,13 @@ function string_to_dble(json,str) result(rval)
80858079

80868080
logical(LK) :: status_ok !! error flag for [[string_to_real]]
80878081

8088-
if (.not. json%exception_thrown) then
8089-
8090-
call string_to_real(str,json%use_quiet_nan,rval,status_ok)
8082+
call string_to_real(str,json%use_quiet_nan,rval,status_ok)
80918083

8092-
if (.not. status_ok) then !if there was an error
8093-
rval = 0.0_RK
8094-
call json%throw_exception('Error in string_to_dble: '//&
8095-
'string cannot be converted to a real: '//&
8096-
trim(str))
8097-
end if
8098-
8099-
else
8084+
if (.not. status_ok) then !if there was an error
81008085
rval = 0.0_RK
8086+
call json%throw_exception('Error in string_to_dble: '//&
8087+
'string cannot be converted to a real: '//&
8088+
trim(str))
81018089
end if
81028090

81038091
end function string_to_dble

0 commit comments

Comments
 (0)