Eric Blake wrote: > How about this simple patch - since the user can request hash_rehash with > any size, it is possible to call hash_rehash when it is otherwise a no-op. > This could also happen, for example, with custom tuning parameters that > shrink the table; eventually, the shrink will pick a value that gets > rounded back up to the same prime number as the current size. ... > diff --git a/lib/hash.c b/lib/hash.c > index 59f1ff0..f2123b4 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
Good one.
