hash_map.h insert does not need a double pointer to the hash map struct #17

Closed
opened 2024-09-07 04:19:11 +00:00 by stephenseo · 1 comment
Owner

int simple_archiver_hash_map_insert(SDArchiverHashMap **hash_map, void *value,

the hash map struct does not need to be a double pointer in the function call to insert.

https://git.seodisparate.com/stephenseo/SimpleArchiver/src/commit/4cd660ffd59f013d2199fc690a1bd5b02b2e3a7f/src/data_structures/hash_map.h#L42 the hash map struct does not need to be a double pointer in the function call to insert.
stephenseo self-assigned this 2024-09-07 04:19:17 +00:00
Author
Owner

The current implementation creates a new hash map struct (due to rehashing when capacity is reached), which was the original purpose of the double pointer; to change the single-pointer to point towards the new hash map struct. This can actually be circumvented by changing the given hash map pointer in-place.

The current implementation creates a new hash map struct (due to rehashing when capacity is reached), which was the original purpose of the double pointer; to change the single-pointer to point towards the new hash map struct. This can actually be circumvented by changing the given hash map pointer in-place.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stephenseo/SimpleArchiver#17
No description provided.