key_matches Function

private function key_matches(this, entry, key) result(same)

Exact key comparison: same length and same characters. Deliberately not the Fortran == operator, which blank-pads the shorter operand.

Arguments

Type IntentOptional Attributes Name
class(hash_map_t), intent(in) :: this
integer(kind=default_int), intent(in) :: entry
character(len=*), intent(in) :: key

Return Value logical


Called by

proc~~key_matches~~CalledByGraph proc~key_matches key_matches proc~find_entry find_entry proc~find_entry->proc~key_matches proc~hash_map_get hash_map_t%hash_map_get proc~hash_map_get->proc~find_entry proc~hash_map_has_key hash_map_t%hash_map_has_key proc~hash_map_has_key->proc~find_entry proc~hash_map_insert hash_map_t%hash_map_insert proc~hash_map_insert->proc~find_entry proc~hash_map_remove hash_map_t%hash_map_remove proc~hash_map_remove->proc~find_entry

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: i

Source Code

   function key_matches(this, entry, key) result(same)
      !! Exact key comparison: same length and same characters. Deliberately
      !! not the Fortran `==` operator, which blank-pads the shorter operand.
      class(hash_map_t), intent(in) :: this
      integer(default_int), intent(in) :: entry
      character(len=*), intent(in) :: key
      logical :: same

      integer(default_int) :: i

      same = .false.
      if (this%key_size(entry) /= int(len(key), default_int)) return
      do i = 1, this%key_size(entry)
         if (this%key_pool(this%key_start(entry) + i - 1) /= key(i:i)) return
      end do
      same = .true.
   end function key_matches