X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb%2Fopen.c;h=95f8f4c940116fa8f64eec4a7cd57ba9c72644b0;hp=aa32a45eda3957aa04e8c9444a9ba2bd749b1207;hb=d117f992bde6b7157a8eecbce8a026f2aa7ab4ae;hpb=9cbb97f3ac06d717afe4ced2c4f624078bb88396 diff --git a/ccan/tdb/open.c b/ccan/tdb/open.c index aa32a45e..95f8f4c9 100644 --- a/ccan/tdb/open.c +++ b/ccan/tdb/open.c @@ -30,20 +30,6 @@ /* all contexts, to ensure no double-opens (fcntl locks don't nest!) */ static struct tdb_context *tdbs = NULL; - -/* This is based on the hash algorithm from gdbm */ -static unsigned int default_tdb_hash(TDB_DATA *key) -{ - uint32_t value; /* Used to compute the hash value. */ - uint32_t i; /* Used to cycle through random values. */ - - /* Set the initial value from the key size. */ - for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++) - value = (value + (key->dptr[i] << (i*5 % 24))); - - return (1103515243 * value + 12345); -} - /* We use two hashes to double-check they're using the right hash function. */ void tdb_header_hash(struct tdb_context *tdb, uint32_t *magic1_hash, uint32_t *magic2_hash) @@ -206,7 +192,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->hash_fn = hash_fn; hash_alg = "user defined"; } else { - tdb->hash_fn = default_tdb_hash; + tdb->hash_fn = tdb_old_hash; hash_alg = "default"; }