You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Regarding functions like void **hashtableFindRef() and others that return or work with pointers to internal structures.
I think we need to be careful about this one. Do we really need it? One problem I see is that it doesn't pause rehashing, so the location may be reused by something else or even deallocated before a caller modifies the pointer. There's no protection at all.
I recommend changing this to return a hashsetPosition instead of a void**. Then you can have something like hashsetGetAtPosition(position) and hashsetReplaceAtPosition(position, newElement). You can use epoch information in the hashsetPosition to guarantee safety, and also perform checks like compare(ele1, ele2) to ensure that the structure is still logically correct.
I tried to refactor the code to achieve this, including adding an epoch counter to the hash table structure to be able to detect changes. It turned out to be a non-trivial amount of refactoring. Since it's not a regression and can be done later, I'm moving it to a follow-up issue.
The text was updated successfully, but these errors were encountered:
Originally posted by @JimB123 in #1186 (review)
Regarding functions like
void **hashtableFindRef()
and others that return or work with pointers to internal structures.Originally posted by @JimB123 in #1186 (comment)
I tried to refactor the code to achieve this, including adding an epoch counter to the hash table structure to be able to detect changes. It turned out to be a non-trivial amount of refactoring. Since it's not a regression and can be done later, I'm moving it to a follow-up issue.
The text was updated successfully, but these errors were encountered: