Skip to content

Commit

Permalink
Revert "Reverting back to in-line allocation"
Browse files Browse the repository at this point in the history
This reverts commit 3c60ba4.
  • Loading branch information
chuckyvt committed Jul 11, 2024
1 parent 3c60ba4 commit 7118fc5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/stdlib_hashmap_chaining.f90
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,11 @@ module subroutine map_chain_entry(map, key, other, conflict)
new_ent % next => map % slots(hash_index) % target
map % slots(hash_index) % target => new_ent
call copy_key( key, new_ent % key )
if ( present(other) ) new_ent % other = other
!if ( present(other) ) new_ent % other = other
if ( present(other) ) then
if ( allocated(new_ent % other) ) deallocate(new_ent % other)
allocate(new_ent % other, source = other)
endif
if ( new_ent % inmap == 0 ) then
map % num_entries = map % num_entries + 1
inmap = map % num_entries
Expand Down
6 changes: 5 additions & 1 deletion src/stdlib_hashmap_open.f90
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,11 @@ module subroutine map_open_entry(map, key, other, conflict)
call allocate_open_map_entry(map, new_ent)
new_ent % hash_val = hash_val
call copy_key( key, new_ent % key )
if ( present( other ) ) new_ent % other = other
if ( present( other ) ) then
!new_ent % other = other
if ( allocated(new_ent % other) ) deallocate(new_ent % other)
allocate(new_ent % other, source = other)
endif
inmap = new_ent % inmap
map % inverse( inmap ) % target => new_ent
map % slots( test_slot ) = inmap
Expand Down

0 comments on commit 7118fc5

Please sign in to comment.