assoc_list_init Subroutine

public subroutine assoc_list_init(a, n, stat)

Arguments

Type IntentOptional Attributes Name
type(assoc_list_t), intent(inout) :: a
integer, intent(in) :: n
integer, intent(out) :: stat

Contents

Source Code


Source Code

subroutine assoc_list_init(a,n,stat)
type(assoc_list_t), intent(inout) :: a
integer, intent(in)               :: n
integer, intent(out)              :: stat

  if (allocated(a%key)) then
     deallocate(a%key)
  endif
  if (allocated(a%value)) then
     deallocate(a%value)
  endif
  a%nslots = n
  a%nitems = 0
  allocate(a%key(n),a%value(n),stat=stat)

end subroutine assoc_list_init