Subject: bug#6524: [PATCH] hash: extend module to deal with non-pointer keys

From: Paul Eggert <[email-masked]>
Date: Thu, 01 Jul 2010 15:39:32 -0700

Re the patch you just reported in:
<http://lists.gnu.org/archive/html/bug-gnulib/2010-07/msg00005.html>

I assume this is to support the du performance improvement that was proposed in
<http://debbugs.gnu.org/db/65/6524.html>.  I see that you incorporated a further
improvement in the gnulib patch, namely, support for NULL keys.

The gnulib change seems fine, but I noticed some problems with the coreutils
part of that earlier proposal.  Among other things, it makes du dump core on a
(large) test case that I have locally.  I don't know why (perhaps there
were further fixes to the gnulib part that I didn't get right?).  I found
out about the core dump only because I had independently prepared a patch
that I think is better: it uses a bit less memory and is quite a bit simpler.
I'll try to merge my patch with your gnulib change and send it off to
bug-coreutils in the next day or two.

My patch, by the way, doesn't hash pointer keys: it just uses size_t values
and casts them to void * (which is what the hash package wants).  This trick
works on all architectures that I know about, but it isn't guaranteed by
C or POSIX and the casts are a bit offputting, so it'd be nice if the hash
package supported hashing size_t keys directly.  That's lower priority, though.