]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/run-13-delete.c
tdb2: tdb_mkdata
[ccan] / ccan / tdb2 / test / run-13-delete.c
index 3eaeee7a29b1ff8e3f707da522d4c6ed7ca29319..c70fec84828059edbb4fb26e0026ef3233857e6a 100644 (file)
@@ -12,7 +12,7 @@
 /* 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);
 }
 
@@ -33,9 +33,7 @@ static bool store_records(struct tdb_context *tdb)
                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);
        }