X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-12-store.c;h=971665535f80406f19994a79103f8ede06bb6224;hb=0f95489bd34ab05869e0bfaabf45149b3b161f28;hp=0b3c29651c44b2cebcc9b4c4fb09754f15afa423;hpb=efdf0f2d8f34b4c01c82c558b350ec36c7329b1e;p=ccan diff --git a/ccan/tdb2/test/run-12-store.c b/ccan/tdb2/test/run-12-store.c index 0b3c2965..97166553 100644 --- a/ccan/tdb2/test/run-12-store.c +++ b/ccan/tdb2/test/run-12-store.c @@ -16,13 +16,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; @@ -30,8 +23,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 }; @@ -54,7 +47,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);