Skip to content

Commit

Permalink
Improve type safety and refactor dict entry handling (valkey-io#749)
Browse files Browse the repository at this point in the history
This pull request introduces several changes to improve the type safety
of Valkey's dictionary implementation:

- Getter/Setter Macros: Implemented macros `DICT_SET_VALUE` and
`DICT_GET_VALUE` to centralize type casting within these macros. This
change emulates the behavior of C++ templates in C, limiting type
casting to specific low-level operations and preventing it from being
spread across the codebase.

- Reduced Assert Overhead: Removed unnecessary asserts from critical hot
paths in the dictionary implementation.

- Consistent Naming: Standardized the naming of dictionary entry types.
For example, all dictionary entry types start their names with
`dictEntry`.


Fix valkey-io#737

---------

Signed-off-by: Ping Xie <[email protected]>
Signed-off-by: Ping Xie <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
  • Loading branch information
2 people authored and enjoy-binbin committed Sep 14, 2024
1 parent 85a5847 commit cc01b6d
Showing 1 changed file with 114 additions and 92 deletions.
Loading

0 comments on commit cc01b6d

Please sign in to comment.