Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(assoc_list_t), | intent(inout) | :: | a | |||
integer, | intent(in) | :: | n | |||
integer, | intent(out) | :: | stat |
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