hash: reduce memory pressure in hash_rehash no-op case
authorEric Blake <ebb9@byu.net>
Fri, 19 Jun 2009 12:35:11 +0000 (06:35 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 19 Jun 2009 13:24:11 +0000 (07:24 -0600)
commitb7b7fad146c914ff9d4c647cf1dcd92e6aed231e
tree259eba77874c6f10b36f68454e00dfe3129b9767
parent3ea7149254196fdcf06e81140c3d6c2910e9daad
hash: reduce memory pressure in hash_rehash no-op case

* lib/hash.c (next_prime): Avoid overflow.
(hash_initialize): Factor bucket size computation...
(compute_bucket_size): ...into new helper function.
(hash_rehash): Use new function and open coding to reduce memory
pressure, and avoid a memory leak in USE_OBSTACK code.
Reported by Jim Meyering.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/hash.c