check_tuning (Hash_table *table)
{
const Hash_tuning *tuning = table->tuning;
+ float epsilon;
if (tuning == &default_tuning)
return true;
fail to grow or shrink as they should. The smallest allocation
is 11 (due to next_prime's algorithm), so an epsilon of 0.1
should be good enough. */
- float epsilon = 0.1f;
+ epsilon = 0.1f;
if (epsilon < tuning->growth_threshold
&& tuning->growth_threshold < 1 - epsilon
allocation fails. */
static bool
-transfer_entries (Hash_table *src, Hash_table *dst, bool safe)
+transfer_entries (Hash_table *dst, Hash_table *src, bool safe)
{
struct hash_entry *bucket;
struct hash_entry *cursor;
#endif
new_table->free_entry_list = table->free_entry_list;
- if (transfer_entries (table, new_table, false))
+ if (transfer_entries (new_table, table, false))
{
/* Entries transferred successfully; tie up the loose ends. */
free (table->bucket);
longer, but at this point, we're already out of memory, so slow
and safe is better than failure. */
table->free_entry_list = new_table->free_entry_list;
- if (! (transfer_entries (new_table, table, true)
- && transfer_entries (new_table, table, false)))
+ if (! (transfer_entries (table, new_table, true)
+ && transfer_entries (table, new_table, false)))
abort ();
/* table->n_entries already holds its value. */
free (new_table->bucket);