clear Subroutine

public subroutine clear(lst)

Arguments

Type IntentOptional Attributes Name
type(llist), intent(inout) :: lst

Contents

Source Code


Variables

Type Visibility Attributes Name Initial
type(llist_node), public, pointer :: next
type(llist_node), public, pointer :: this

Source Code

    subroutine clear(lst)
      type(llist), intent(inout) :: lst
      type(llist_node), pointer  :: this, next
      this => lst%begin
      do
         if (.not. associated(this)) exit
         next => this%next
         deallocate(this)
         this => next
      end do
      nullify(lst%end)
      nullify(lst%begin)
    end subroutine clear