dict_str_i4_destroy Subroutine

private subroutine dict_str_i4_destroy(dict)

Deallocated the internal data-structures if the given dictionary. Caution: If the stored keys or values are pointers, their targets will not get deallocated by this routine.

Arguments

Type IntentOptional Attributes Name
type(dict_str_i4_type), intent(inout) :: dict

Source Code

      SUBROUTINE dict_str_i4_destroy(dict)
      !! Deallocated the internal data-structures if the given dictionary.
      !! Caution: If the stored keys or values are pointers, their targets will
      !! not get deallocated by this routine.

         TYPE(dict_str_i4_type), intent(inout)  :: dict
         TYPE(private_item_type_str_i4), POINTER  :: item, prev_item
         INTEGER :: i

         IF (.not. ASSOCIATED(dict%buckets)) &
            DBCSR_ABORT("dict_str_i4_destroy: dictionary is not initialized.")

         do i = 1, size(dict%buckets)
            item => dict%buckets(i)%p
            do while (ASSOCIATED(item))
               prev_item => item
               item => item%next
               deallocate (prev_item)
            end do
         end do

         deallocate (dict%buckets)
         dict%size = -1

      END SUBROUTINE dict_str_i4_destroy