@@ -2052,9 +2052,10 @@ recursive subroutine json_value_destroy(json,p,destroy_next)
2052
2052
logical (LK),intent (in ),optional :: destroy_next ! ! if true, then `p%next`
2053
2053
! ! is also destroyed (default is true)
2054
2054
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
2058
2059
2059
2060
if (associated (p)) then
2060
2061
@@ -2154,8 +2155,10 @@ subroutine json_value_remove(json,p,destroy)
2154
2155
! ! * If `destroy` is present and true, it is destroyed.
2155
2156
! ! * If `destroy` is present and false, it is not destroyed.
2156
2157
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
2159
2162
2160
2163
if (associated (p)) then
2161
2164
@@ -2324,11 +2327,16 @@ subroutine json_value_swap(json,p1,p2)
2324
2327
implicit none
2325
2328
2326
2329
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`
2329
2332
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
2332
2340
2333
2341
if (json% exception_thrown) return
2334
2342
@@ -2349,8 +2357,6 @@ subroutine json_value_swap(json,p1,p2)
2349
2357
associated (p2% parent) .and. &
2350
2358
associated (p1% parent,p2% parent) )
2351
2359
if (same_parent) then
2352
- ! if p1,p2 are the first,last or last,first
2353
- ! children of a common parent
2354
2360
first_last = (associated (p1% parent% children,p1) .and. &
2355
2361
associated (p2% parent% tail,p2)) .or. &
2356
2362
(associated (p1% parent% tail,p1) .and. &
0 commit comments