[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another hash cleanup
From: |
Jim Meyering |
Subject: |
Re: another hash cleanup |
Date: |
Thu, 18 Jun 2009 21:22:38 +0200 |
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.
- Re: hash resizing bug, (continued)
- Re: hash resizing bug, Eric Blake, 2009/06/18
- Re: hash resizing bug, Jim Meyering, 2009/06/18
- Re: hash resizing bug, Eric Blake, 2009/06/18
- hash and bitrotate (was: hash resizing bug), Eric Blake, 2009/06/18
- Re: hash and bitrotate, Eric Blake, 2009/06/18
- Re: hash and bitrotate, Jim Meyering, 2009/06/18
- Re: hash and bitrotate, Simon Josefsson, 2009/06/18
- Re: hash resizing bug, Jim Meyering, 2009/06/18
- Re: hash resizing bug, Ben Pfaff, 2009/06/18
- another hash cleanup (was: hash resizing bug), Eric Blake, 2009/06/18
- Re: another hash cleanup,
Jim Meyering <=
- Re: another hash cleanup, Eric Blake, 2009/06/18
- Re: another hash cleanup, Jim Meyering, 2009/06/18
- Re: another hash cleanup, Eric Blake, 2009/06/18
- Re: another hash cleanup, Jim Meyering, 2009/06/19
- Re: another hash cleanup, Eric Blake, 2009/06/19
- Re: another hash cleanup, Jim Meyering, 2009/06/19
- Re: another hash cleanup, Eric Blake, 2009/06/19
- Re: another hash cleanup, Jim Meyering, 2009/06/19
- Re: another hash cleanup, Eric Blake, 2009/06/19
- Re: another hash cleanup, Jim Meyering, 2009/06/19