bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alt hash implementation


From: Eric Blake
Subject: Re: alt hash implementation
Date: Wed, 17 Jun 2009 12:57:45 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Jim Meyering on 6/17/2009 12:20 PM:
>> Here's what I squashed to fix things:
> 
> Thanks.  I'd noticed ;-)
> 
> I noticed another problem: this fails when n_buckets_used is 0:
> 
>     size_t needed = table->n_buckets_used - 1;

Good catch.  I've squashed this in (plus the accompanying indentation
change)...

diff --git a/lib/hash.c b/lib/hash.c
index e77184a..9d78990 100644
- --- a/lib/hash.c
+++ b/lib/hash.c
@@ -863,6 +863,7 @@ hash_rehash (Hash_table *table, size_t candidate)
      check that there are at least table->n_buckets_used-1 entries on
      the free entry list for the worst case collision (everything gets
      combined into one bucket during the rehash).  */
+  if (table->n_buckets_used)
   {
     size_t needed = table->n_buckets_used - 1;
     size_t available;


> 
> Would you please post (or push somewhere) your patches?

and posted it all here (sorry for not doing that sooner):
http://repo.or.cz/w/gnulib/ericb.git
$ git pull git://repo.or.cz/gnulib/ericb.git master

So far, though, I have not attempted anything to resolve the hash_rehash
failure to allow multiple resizes.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko5PKkACgkQ84KuGfSFAYBLmQCgrpRV4v3+a73+awRLbzgMSsGk
FR4An1hvyWMsw7erzZtP7gnGQzBHmas3
=zbtI
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]