X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-12-store.c;h=73ffd554f525d6e18922c63abd8279742b3ef232;hp=8ab9ddc1cc977c06d31cbe06ec0a841a9da11490;hb=d9cbd7d4454ae35e4e2f6d18a9469bf26948e4b9;hpb=c8c9a4693b9fbe2a6b2b6dfced49958db5c7fdd4 diff --git a/ccan/tdb2/test/run-12-store.c b/ccan/tdb2/test/run-12-store.c index 8ab9ddc1..73ffd554 100644 --- a/ccan/tdb2/test/run-12-store.c +++ b/ccan/tdb2/test/run-12-store.c @@ -1,10 +1,4 @@ -#include -#include -#include -#include -#include -#include -#include +#include "tdb2-source.h" #include #include "logging.h" @@ -15,13 +9,6 @@ static uint64_t fixedhash(const void *key, size_t len, uint64_t seed, void *p) *(uint64_t *)p); } -static bool equal(struct tdb_data a, struct tdb_data b) -{ - if (a.dsize != b.dsize) - return false; - return memcmp(a.dptr, b.dptr, a.dsize) == 0; -} - int main(int argc, char *argv[]) { unsigned int i, j; @@ -29,8 +16,8 @@ int main(int argc, char *argv[]) uint64_t seed = 16014841315512641303ULL; union tdb_attribute fixed_hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = fixedhash, - .hash_private = &seed } }; + .fn = fixedhash, + .data = &seed } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT }; @@ -53,7 +40,7 @@ int main(int argc, char *argv[]) struct tdb_data d = { NULL, 0 }; /* Bogus GCC warning */ ok1(tdb_store(tdb, key, data, TDB_REPLACE) == 0); ok1(tdb_fetch(tdb, key, &d) == TDB_SUCCESS); - ok1(equal(d, data)); + ok1(tdb_deq(d, data)); free(d.dptr); } tdb_close(tdb);