summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-06-19 18:49:24 +0200
committerJim Meyering <meyering@redhat.com>2009-06-19 18:51:14 +0200
commit5082839d34680c5dea88d3b65f021805b963c04d (patch)
tree600caa76cb316d6ecd6c53be02a22b8adb4110f3
parent4b3351f5c0077459bcdfd5c26607ee1b31602ba6 (diff)
downloadgnulib-5082839d34680c5dea88d3b65f021805b963c04d.tar.gz
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.
-rw-r--r--ChangeLog4
-rw-r--r--lib/hash.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 16cbdbc705..6553c47515 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
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.
diff --git a/lib/hash.c b/lib/hash.c
index bce97e38c3..cc6ebb322c 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -853,7 +853,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 +985,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 +1012,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);