[Nickle] Hash keys not copied?

Keith Packard keithp at keithp.com
Mon Dec 31 01:18:00 PST 2007


I know this issue has come up, but it just bit me fairly hard and I
thought I'd raise it again.

The keys in hash objects are not copied, which means that future changes
to the key invalidate the hash table -- the table uses a 32-bit hash of
the key to distribute objects across the array, but with the value
changing, it will not be moved in the table. Thus, lookups on the old
value will fail (as the value is now different), but lookups on the
*new* value will also fail (it will look under the wrong 32-bit hash
key).

I don't see any way to avoid copying the key.

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : /pipermail/nickle/attachments/20071231/0435fc39/attachment.pgp 


More information about the Nickle mailing list