box64 icon indicating copy to clipboard operation
box64 copied to clipboard

[RBTREE] Refactor `rb_*` APIs to Generic Naming for Future Flexibility

Open devarajabc opened this issue 6 months ago • 1 comments

The current API set for range management is tightly coupled to the rbtree implementation, with function names prefixed as rb_*.

However, the underlying data structure may evolve in the future.

To decouple the interface from the specific data structure and improve long-term maintainability, I propose renaming the rb_* APIs to use a more generic range_* prefix.

The proposed range_* prefix does not imply a change in implementation — it is simply an abstraction layer over the current rbtree. This naming can remain stable even if the underlying structure changes.

Proposed Renaming

Current Name Proposed Name
rbtree_init range_init
rbtree_delet range_delete
rb_get range_get
rb_get_64 range_get_64
rb_get_end range_get_end
rb_get_end_64 range_get_end_64
rb_set range_set
rb_set_64 range_set_64
rb_unset range_unset
rb_inc range_inc
rb_dec range_dec
rb_get_rightmost range_get_rightmost
rb_get_leftmost range_get_leftmost

Feel free to close this if it's not needed — I can submit a PR for this refactor if you think it's worthwhile.

devarajabc avatar Jun 09 '25 03:06 devarajabc

Tbh, I prefer the rb_* prefixed API, it's more "unique". But it's just a mater of taste. @rajdakin your thoughs?

ptitSeb avatar Jun 09 '25 06:06 ptitSeb