The hash_table_insert function currently takes void *key and void *value as arguments. However, the function does not modify the pointed-to data; it only reads from it to make a copy.
The function signature should be changed to:
bool hash_table_insert(HashTable *table, const void *key, const void *value);
This change improves the API's correctness and allows users to pass const-qualified data without unnecessary casting, making the API safer and easier to use.
The
hash_table_insertfunction currently takesvoid *keyandvoid *valueas arguments. However, the function does not modify the pointed-to data; it only reads from it to make a copy.The function signature should be changed to:
This change improves the API's correctness and allows users to pass
const-qualified data without unnecessary casting, making the API safer and easier to use.