/* We rig the hash so adjacent-numbered records always clash. */
static uint64_t clash(const void *key, size_t len, uint64_t seed, void *priv)
{
- return ((uint64_t)*(unsigned int *)key)
+ return ((uint64_t)*(const unsigned int *)key)
<< (64 - TDB_TOPLEVEL_HASH_BITS - 1);
}
if (tdb_store(tdb, key, data, TDB_REPLACE) != 0)
return false;
tdb_fetch(tdb, key, &d);
- if (d.dsize != data.dsize)
- return false;
- if (memcmp(d.dptr, data.dptr, d.dsize) != 0)
+ if (!tdb_deq(d, data))
return false;
free(d.dptr);
}
/* Check mixed bitpattern. */
test_val(tdb, 0x123456789ABCDEF0ULL);
- ok1(tdb->allrecord_lock.count == 0 && tdb->num_lockrecs == 0);
+ ok1(!tdb->file || (tdb->file->allrecord_lock.count == 0
+ && tdb->file->num_lockrecs == 0));
tdb_close(tdb);
/* Deleting these entries in the db gave problems. */