avoid long pointer transversal
This commit is contained in:
parent
00671f943b
commit
ca0df3389a
|
@ -119,7 +119,8 @@ module YAML_types
|
||||||
|
|
||||||
type, extends(tNode), public :: tList
|
type, extends(tNode), public :: tList
|
||||||
|
|
||||||
class(tItem), pointer :: first => NULL()
|
class(tItem), pointer :: first => NULL(), &
|
||||||
|
last => NULL()
|
||||||
|
|
||||||
contains
|
contains
|
||||||
procedure :: asFormattedString => tList_asFormattedString
|
procedure :: asFormattedString => tList_asFormattedString
|
||||||
|
@ -1350,13 +1351,11 @@ subroutine tList_append(self,node)
|
||||||
if (.not. associated(self%first)) then
|
if (.not. associated(self%first)) then
|
||||||
allocate(item)
|
allocate(item)
|
||||||
self%first => item
|
self%first => item
|
||||||
|
self%last => item
|
||||||
else
|
else
|
||||||
item => self%first
|
allocate(self%last%next)
|
||||||
do while (associated(item%next))
|
item => self%last%next
|
||||||
item => item%next
|
self%last => item
|
||||||
enddo
|
|
||||||
allocate(item%next)
|
|
||||||
item => item%next
|
|
||||||
end if
|
end if
|
||||||
|
|
||||||
item%node => node
|
item%node => node
|
||||||
|
|
Loading…
Reference in New Issue