Skip to content

Commit 3c60ba4

Browse files
committed
Reverting back to in-line allocation
Reverting back to inline allocation based on PR discussion. Both approaches seemed to work fine.
1 parent 0e29642 commit 3c60ba4

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/stdlib_hashmap_chaining.f90

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -569,11 +569,7 @@ module subroutine map_chain_entry(map, key, other, conflict)
569569
new_ent % next => map % slots(hash_index) % target
570570
map % slots(hash_index) % target => new_ent
571571
call copy_key( key, new_ent % key )
572-
!if ( present(other) ) new_ent % other = other
573-
if ( present(other) ) then
574-
if ( allocated(new_ent % other) ) deallocate(new_ent % other)
575-
allocate(new_ent % other, source = other)
576-
endif
572+
if ( present(other) ) new_ent % other = other
577573
if ( new_ent % inmap == 0 ) then
578574
map % num_entries = map % num_entries + 1
579575
inmap = map % num_entries

src/stdlib_hashmap_open.f90

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,11 +553,7 @@ module subroutine map_open_entry(map, key, other, conflict)
553553
call allocate_open_map_entry(map, new_ent)
554554
new_ent % hash_val = hash_val
555555
call copy_key( key, new_ent % key )
556-
if ( present( other ) ) then
557-
!new_ent % other = other
558-
if ( allocated(new_ent % other) ) deallocate(new_ent % other)
559-
allocate(new_ent % other, source = other)
560-
endif
556+
if ( present( other ) ) new_ent % other = other
561557
inmap = new_ent % inmap
562558
map % inverse( inmap ) % target => new_ent
563559
map % slots( test_slot ) = inmap

0 commit comments

Comments
 (0)