summaryrefslogtreecommitdiff
path: root/lib/hash.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-06-18 13:18:34 -0600
committerEric Blake <ebb9@byu.net>2009-06-18 13:18:34 -0600
commit86514ea5ebf71c35726c21ae077f2a3a10e196e2 (patch)
treee91e25bea3c0112a09242b46d5dbecddf25d34ba /lib/hash.c
parentaf254bfe03b99e242c8b12e8c76a76df1a1805cf (diff)
downloadgnulib-86514ea5ebf71c35726c21ae077f2a3a10e196e2.tar.gz
hash: avoid no-op rehashing
* lib/hash.c (hash_rehash): Recognize useless rehash attempts. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/hash.c')
-rw-r--r--lib/hash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/hash.c b/lib/hash.c
index 59f1ff0d07..f2123b4e4c 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -862,6 +862,8 @@ hash_rehash (Hash_table *table, size_t candidate)
table->comparator, table->data_freer);
if (new_table == NULL)
return false;
+ if (new_table->n_buckets == table->n_buckets)
+ return true;
/* Merely reuse the extra old space into the new table. */
#if USE_OBSTACK