Open
Conversation
- Also quells gfortran "Warning: Impure function ‘n_collisions’ at (1) might not be evaluated [-Wfunction-elimination]"
…possibly more performant)
- Makes 'clear' redundant; memory is deleted automatically
- users will need to define HASH_FUNC excplicitly if they want a user-specied hash function
- based on qsort from C standard library
FObermaier
approved these changes
Dec 8, 2022
Contributor
FObermaier
left a comment
There was a problem hiding this comment.
I'm fine with these changes. @jl2922 could you take a look?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Junhao Li,
Thanks a lot for contributing this code! I can tell you it will be used to model traffic flow in the Netherlands.
I did find some places in which the code could be cleaned up a bit, and collected them in this branch. I hope it will be of use to you and others as well.
The main things it addresses:
corrected
intentstatements (inout --> in)corrected
.not. associated(this%node_ptr) .or. .not. allocated(this%node_ptr%kv)statement (Fortran is not guaranteed to evaluate from left to right)deleted redundant
deallocatestatementssimplified
node_getgreatly simplified the
cleanprocedures. Furthermore, memory is now freed automatically by destructors (aka finalizers), so the user does not need to callcleanon the hash table.non_overridableprocedures (also helps the compiler to know what exact method you're calling at compile time)Some more flags in the Makefile (maybe you don't want those)