-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(rax_tree): Introduce raxFreeWithCallback call in RaxTreeMap destructor #4255
chore(rax_tree): Introduce raxFreeWithCallback call in RaxTreeMap destructor #4255
Conversation
4c9cb6e
to
aebcbdc
Compare
} | ||
|
||
/* Free a whole radix tree with a callback */ | ||
void raxFreeWithCallback(rax *rax, void (*free_callback)(void*)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Niiiiice 💯
aebcbdc
to
c292bfe
Compare
…tructor Signed-off-by: Stepan Bagritsevich <[email protected]>
c292bfe
to
2f13e11
Compare
rax_free(n); | ||
rax->numnodes--; | ||
} | ||
|
||
/* Free the entire radix tree, invoking a free_callback function for each key's data. | ||
* An additional argument is passed to the free_callback function.*/ | ||
void raxFreeWithCallbackAndArgument(rax *rax, void (*free_callback)(void*, void*), void* argument) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call this:
void raxFreeWithCallbackAndArgument(rax *rax, void (*free_callback)(void*, void*), void* argument) { | |
void raxRecursiveFreeWithCallbackAndArgument(rax *rax, void (*free_callback)(void*, void*), void* argument) { |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, because Redis provides raxFreeWithCallback
as a public API. And raxRecursiveFree
is an internal method and not part of the public API. So for consistency, I think raxFreeWithCallbackAndArgument
would be a better choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok 🤷
rax_free(n); | ||
rax->numnodes--; | ||
} | ||
|
||
/* Free the entire radix tree, invoking a free_callback function for each key's data. | ||
* An additional argument is passed to the free_callback function.*/ | ||
void raxFreeWithCallbackAndArgument(rax *rax, void (*free_callback)(void*, void*), void* argument) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok 🤷
related to this comment