URL:
https://github.com/SSSD/sssd/pull/977
Title: #977: sss_ptr_hash: internal refactoring
alexey-tikhonov commented:
"""
Thank you. It looks good to me. I have just some suggestions about
deleting items that might simplify the code more...
Thank you for the feedback.
The basic idea is to move `hash_delete` into
`sss_ptr_hash_value_destructor`. Would it be possible?
Then you could do the following changes:
* `sss_ptr_hash_delete` use lookup -> free(value) / calls hash_delete from cb
-> free(payload)
* `sss_ptr_hash_delete_all` - use `hash_values` instead of `hash_keys` and iterate
over values and just call `talloc_free(values)`
* `sss_ptr_hash_delete_cb` - `talloc_steal(NULL, value)` could be moved to
`sss_ptr_hash_value_destructor`
Do I understand correctly that idea is to assure that the only possible execution chain to
get into `sss_ptr_hash_delete_cb()` is:
**`talloc_free(sss_ptr_hash_value)`** `-> sss_ptr_hash_value_destructor() ->
hash_delete()`
(so that `sss_ptr_hash_delete_cb()` doesn't need to check if execution is/is not in
`talloc_free(sss_ptr_hash_value)` context)?
"""
See the full comment at
https://github.com/SSSD/sssd/pull/977#issuecomment-580773585