2009-06-19 Jim Meyering <meyering@redhat.com>
+ hash: reverse order of src/dst parameters in an internal interface
+ * lib/hash.c (transfer_entries): Reverse order of parameters to
+ put DST before SRC. Adjust callers.
+
tests: test-hash: avoid wholesale duplication
* tests/test-hash.c (main): Don't copy/paste a 60-line loop.
Instead, use a loop and add a single conditional.
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);