hash_map: Use const where applicable
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s

This commit is contained in:
Stephen Seo 2024-09-04 15:30:37 +09:00
parent dd1a8abdd4
commit 4cd660ffd5
2 changed files with 5 additions and 5 deletions

View file

@ -75,7 +75,7 @@ int simple_archiver_hash_map_internal_pick_in_list(void *data, void *ud) {
}
unsigned long long simple_archiver_hash_map_internal_key_to_hash(
void *key, unsigned int key_size) {
const void *key, unsigned int key_size) {
unsigned long long seed = 0;
unsigned long long temp = 0;
unsigned int count = 0;
@ -213,8 +213,8 @@ int simple_archiver_hash_map_insert(SDArchiverHashMap **hash_map, void *value,
}
}
void *simple_archiver_hash_map_get(SDArchiverHashMap *hash_map, void *key,
unsigned int key_size) {
void *simple_archiver_hash_map_get(const SDArchiverHashMap *hash_map,
const void *key, unsigned int key_size) {
unsigned long long hash =
simple_archiver_hash_map_internal_key_to_hash(key, key_size) %
hash_map->buckets_size;

View file

@ -45,8 +45,8 @@ int simple_archiver_hash_map_insert(SDArchiverHashMap **hash_map, void *value,
void (*key_cleanup_fn)(void *));
/// Returns NULL if not found.
void *simple_archiver_hash_map_get(SDArchiverHashMap *hash_map, void *key,
unsigned int key_size);
void *simple_archiver_hash_map_get(const SDArchiverHashMap *hash_map,
const void *key, unsigned int key_size);
/// Returns zero on success. Returns one if more than one entry was removed.
/// Otherwise returns non-zero and non-one value on error.