]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/hash.c
tdb2: tdb_set_attribute, tdb_unset_attribute and tdb_get_attribute
[ccan] / ccan / tdb2 / hash.c
index b1307d985bef413edc2ebea3bb0fe2eaec4e16b0..745f04c87e5574f50719b3018b4a78f7167fbbd6 100644 (file)
 */
 #include "private.h"
 #include <assert.h>
-#include <ccan/hash/hash.h>
-
-static uint64_t jenkins_hash(const void *key, size_t length, uint64_t seed,
-                            void *arg)
-{
-       uint64_t ret;
-       /* hash64_stable assumes lower bits are more important; they are a
-        * slightly better hash.  We use the upper bits first, so swap them. */
-       ret = hash64_stable((const unsigned char *)key, length, seed);
-       return (ret >> 32) | (ret << 32);
-}
-
-void tdb_hash_init(struct tdb_context *tdb)
-{
-       tdb->hashfn = jenkins_hash;
-}
 
 uint64_t tdb_hash(struct tdb_context *tdb, const void *ptr, size_t len)
 {
-       return tdb->hashfn(ptr, len, tdb->hash_seed, tdb->hash_data);
+       return tdb->hash_fn(ptr, len, tdb->hash_seed, tdb->hash_data);
 }
 
 uint64_t hash_record(struct tdb_context *tdb, tdb_off_t off)