hash: factor, and guard against misbehaving hasher function
authorEric Blake <eblake@redhat.com>
Tue, 31 Aug 2010 08:10:32 +0000 (10:10 +0200)
committerEric Blake <eblake@redhat.com>
Tue, 31 Aug 2010 14:30:10 +0000 (08:30 -0600)
commitc0ebdfe226c38c72db7c1944113fd19ff534e362
tree22f5ee0d67a5b712ade3898814f97fea93d42481
parente85049070e2d175e247787ebcc2241b77cb8939f
hash: factor, and guard against misbehaving hasher function

* lib/hash.c (safe_hasher): New function, to encapsulate the checking
of table->hasher's return value.  Also protect against a hash value
so large that adding it to table->bucket results in a NULL pointer.
(hash_lookup, hash_get_next, hash_find_entry, transfer_entries):
Use it in place of open-coded check-and-abort.
ChangeLog
lib/hash.c