diff options
-rw-r--r-- | st.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -103,12 +103,14 @@ #ifdef NOT_RUBY #include "regint.h" #include "st.h" #elif defined RUBY_EXPORT #include "internal.h" #include "internal/bits.h" #include "internal/hash.h" #include "internal/sanitizers.h" #include "internal/st.h" #endif #include <stdio.h> @@ -116,7 +118,6 @@ #include <stdlib.h> #endif #include <string.h> -#include <assert.h> #ifdef __GNUC__ #define PREFETCH(addr, write_p) __builtin_prefetch(addr, write_p) @@ -314,17 +315,22 @@ static const struct st_features features[] = { #define RESERVED_HASH_VAL (~(st_hash_t) 0) #define RESERVED_HASH_SUBSTITUTION_VAL ((st_hash_t) 0) -/* Return hash value of KEY for table TAB. */ static inline st_hash_t -do_hash(st_data_t key, st_table *tab) { - st_hash_t hash = (st_hash_t)(tab->type->hash)(key); - /* RESERVED_HASH_VAL is used for a deleted entry. Map it into another value. Such mapping should be extremely rare. */ return hash == RESERVED_HASH_VAL ? RESERVED_HASH_SUBSTITUTION_VAL : hash; } /* Power of 2 defining the minimal number of allocated entries. */ #define MINIMAL_POWER2 2 @@ -784,6 +790,8 @@ rebuild_table_with(st_table *const new_tab, st_table *const tab) new_tab->num_entries++; ni++; } } static void @@ -1173,6 +1181,8 @@ st_add_direct_with_hash(st_table *tab, st_index_t ind; st_index_t bin_ind; rebuild_table_if_necessary(tab); ind = tab->entries_bound++; entry = &tab->entries[ind]; @@ -1190,7 +1200,7 @@ void rb_st_add_direct_with_hash(st_table *tab, st_data_t key, st_data_t value, st_hash_t hash) { - st_add_direct_with_hash(tab, key, value, hash); } /* Insert (KEY, VALUE) into table TAB. The table should not have |