Merge commit '039ae97'
[gnulib.git] / lib / hash.c
index bce97e3..3ab7136 100644 (file)
@@ -505,6 +505,7 @@ static bool
 check_tuning (Hash_table *table)
 {
   const Hash_tuning *tuning = table->tuning;
+  float epsilon;
   if (tuning == &default_tuning)
     return true;
 
@@ -513,7 +514,7 @@ check_tuning (Hash_table *table)
      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
@@ -853,7 +854,7 @@ hash_find_entry (Hash_table *table, const void *entry,
    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;
@@ -985,7 +986,7 @@ hash_rehash (Hash_table *table, size_t candidate)
 #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);
@@ -1012,8 +1013,8 @@ hash_rehash (Hash_table *table, size_t candidate)
      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);