X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=lib%2Ftdb%2Fcommon%2Fopen.c;h=f0e2dfc7e1bba10219876ac53cb96f86b461df19;hb=58c9d90c758aa7c062d84ab97f62947190526356;hp=a9649945095b67ef29a389115bc7cc70d5d5c2c3;hpb=7cda5507f90d7598d745a1acfc66c2afa73cd4b5;p=metze%2Fctdb%2Fwip.git diff --git a/lib/tdb/common/open.c b/lib/tdb/common/open.c index a9649945..f0e2dfc7 100644 --- a/lib/tdb/common/open.c +++ b/lib/tdb/common/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) @@ -191,7 +177,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"; }