-typedef struct HT HT;
-
-unsigned int
- hash_get_n_slots_used (const HT *ht);
-
-unsigned int
- hash_get_max_chain_length (HT *ht);
-
-int
- hash_rehash (HT *ht, unsigned int new_table_size);
-
-unsigned int
- hash_get_table_size (const HT *ht);
-
-HT *
- hash_initialize (unsigned int table_size,
- void (*key_freer) (void *key),
- unsigned int (*hash) (const void *, unsigned int),
- int (*equality_tester) (const void *, const void *));
-
-unsigned int
- hash_get_n_keys (const HT *ht);
-
-int
- hash_query_in_table (const HT *ht, const void *e);
-
-void *
- hash_lookup (const HT *ht, const void *e);
-
-void *
- hash_insert_if_absent (HT *ht, const void *e, int *failed);
-
-void *
- hash_delete_if_present (HT *ht, const void *e);
-
-void
- hash_print_statistics (const HT *ht, FILE *stream);
-
-int
- hash_get_statistics (const HT *ht, unsigned int *n_slots_used,
- unsigned int *n_keys,
- unsigned int *max_chain_length);
-
-int
- hash_table_ok (HT *ht);
-
-void
- hash_do_for_each (HT *ht, void (*f) (void *e, void *aux), void *aux);
-
-int
- hash_do_for_each_2 (HT *ht, int (*f) (void *e, void *aux), void *aux);
-
-int
- hash_do_for_each_in_selected_bucket (HT *ht, const void *key,
- int (*f) (const void *bucket_key,
- void *e, void *aux),
- void *aux);
-
-void
- hash_clear (HT *ht);
-
-void
- hash_free (HT *ht);
-
-void
- hash_get_key_list (const HT *ht, unsigned int bufsize, void **buf);
-
-void *
- hash_get_first (const HT *ht);
-
-void *
- hash_get_next (const HT *ht, const void *e);
-
-/* This interface to hash_insert_if_absent is used frequently enough to
- merit a macro here. */
-
-# define HASH_INSERT_NEW_ITEM(Ht, Item, Failp) \
- do \
- { \
- void *_already; \
- _already = hash_insert_if_absent ((Ht), (Item), Failp); \
- assert (_already == NULL); \
- } \
- while (0)
+struct hash_tuning
+ {
+ /* This structure is mainly used for `hash_initialize', see the block
+ documentation of `hash_reset_tuning' for more complete comments. */
+
+ float shrink_threshold; /* ratio of used buckets to trigger a shrink */
+ float shrink_factor; /* ratio of new smaller size to original size */
+ float growth_threshold; /* ratio of used buckets to trigger a growth */
+ float growth_factor; /* ratio of new bigger size to original size */
+ bool is_n_buckets; /* if CANDIDATE really means table size */
+ };