@@ -2052,9 +2052,10 @@ recursive subroutine json_value_destroy(json,p,destroy_next)
20522052 logical (LK),intent (in ),optional :: destroy_next ! ! if true, then `p%next`
20532053 ! ! is also destroyed (default is true)
20542054
2055- logical (LK) :: des_next ! ! local copy of `destroy_next` optional argument
2056- type (json_value), pointer :: child ! ! for getting child elements
2057- logical :: circular ! ! to check to malformed linked lists
2055+ logical (LK) :: des_next ! ! local copy of `destroy_next`
2056+ ! ! optional argument
2057+ type (json_value),pointer :: child ! ! for getting child elements
2058+ logical :: circular ! ! to check to malformed linked lists
20582059
20592060 if (associated (p)) then
20602061
@@ -2154,8 +2155,10 @@ subroutine json_value_remove(json,p,destroy)
21542155 ! ! * If `destroy` is present and true, it is destroyed.
21552156 ! ! * If `destroy` is present and false, it is not destroyed.
21562157
2157- type (json_value),pointer :: parent,previous,next
2158- logical (LK) :: destroy_it
2158+ type (json_value),pointer :: parent ! ! pointer to parent
2159+ type (json_value),pointer :: previous ! ! pointer to previous
2160+ type (json_value),pointer :: next ! ! pointer to next
2161+ logical (LK) :: destroy_it ! ! if `p` should be destroyed
21592162
21602163 if (associated (p)) then
21612164
@@ -2324,11 +2327,16 @@ subroutine json_value_swap(json,p1,p2)
23242327 implicit none
23252328
23262329 class(json_core),intent (inout ) :: json
2327- type (json_value),pointer :: p1
2328- type (json_value),pointer :: p2
2330+ type (json_value),pointer :: p1 ! ! swap with `p2`
2331+ type (json_value),pointer :: p2 ! ! swap with `p1`
23292332
2330- logical :: same_parent,first_last,adjacent
2331- type (json_value),pointer :: a,b
2333+ logical :: same_parent ! ! if `p1` and `p2` have the same parent
2334+ logical :: first_last ! ! if `p1` and `p2` are the first,last or
2335+ ! ! last,first children of a common parent
2336+ logical :: adjacent ! ! if `p1` and `p2` are adjacent
2337+ ! ! elements in an array
2338+ type (json_value),pointer :: a ! ! temporary variable
2339+ type (json_value),pointer :: b ! ! temporary variable
23322340
23332341 if (json% exception_thrown) return
23342342
@@ -2349,8 +2357,6 @@ subroutine json_value_swap(json,p1,p2)
23492357 associated (p2% parent) .and. &
23502358 associated (p1% parent,p2% parent) )
23512359 if (same_parent) then
2352- ! if p1,p2 are the first,last or last,first
2353- ! children of a common parent
23542360 first_last = (associated (p1% parent% children,p1) .and. &
23552361 associated (p2% parent% tail,p2)) .or. &
23562362 (associated (p1% parent% tail,p1) .and. &
0 commit comments