@@ -1321,7 +1321,7 @@ end subroutine json_clone
13211321! @note If new data is added to the [[json_value]] type,
13221322! then this would need to be updated.
13231323
1324- recursive subroutine json_value_clone_func (from ,to ,parent ,previous ,next , children , tail )
1324+ recursive subroutine json_value_clone_func (from ,to ,parent ,previous ,tail )
13251325
13261326 implicit none
13271327
@@ -1330,8 +1330,6 @@ recursive subroutine json_value_clone_func(from,to,parent,previous,next,children
13301330 ! ! must not already be associated)
13311331 type (json_value),pointer ,optional :: parent ! ! to%parent
13321332 type (json_value),pointer ,optional :: previous ! ! to%previous
1333- type (json_value),pointer ,optional :: next ! ! to%next
1334- type (json_value),pointer ,optional :: children ! ! to%children
13351333 logical ,optional :: tail ! ! if "to" is the tail of
13361334 ! ! its parent's children
13371335
@@ -1352,33 +1350,28 @@ recursive subroutine json_value_clone_func(from,to,parent,previous,next,children
13521350 to % var_type = from% var_type
13531351 to % n_children = from% n_children
13541352
1355- ! allocate and associate the pointers as necessary:
1356-
1357- if (present (parent)) to % parent = > parent
1358- if (present (previous)) to % previous = > previous
1359- if (present (next)) to % next = > next
1360- if (present (children)) to % children = > children
1353+ ! allocate and associate the pointers as necessary:
1354+ if (present (parent)) to % parent = > parent
1355+ if (present (previous)) to % previous = > previous
13611356 if (present (tail)) then
13621357 if (tail .and. associated (to % parent)) to % parent% tail = > to
13631358 end if
13641359
13651360 if (associated (from% next) .and. associated (to % parent)) then
13661361 ! we only clone the next entry in an array
13671362 ! if the parent has also been cloned
1368- allocate (to % next)
1369- call json_value_clone_func(from% next,&
1370- to % next,&
1371- previous= to ,&
1372- parent= to % parent,&
1373- tail= (.not. associated (from% next% next)))
1363+ call json_value_clone_func(from = from% next,&
1364+ to = to % next,&
1365+ previous = to ,&
1366+ parent = to % parent,&
1367+ tail = (.not. associated (from% next% next)))
13741368 end if
13751369
13761370 if (associated (from% children)) then
1377- allocate (to % children)
1378- call json_value_clone_func(from% children,&
1379- to % children,&
1380- parent= to ,&
1381- tail= (.not. associated (from% children% next)))
1371+ call json_value_clone_func(from = from% children,&
1372+ to = to % children,&
1373+ parent = to ,&
1374+ tail = (.not. associated (from% children% next)))
13821375 end if
13831376
13841377 end if
0 commit comments