X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-12-store.c;h=5c21e3a1d0cd0ab8d3658b18d31bfd4979b03843;hp=2cc3e86b6a50bb2c650ffdf5aff453c6ca8f4c31;hb=a4393df8ed138b853b4ff212db7e1a50aba0b8c7;hpb=b21004624683be5bf1d8f75e3b5be4e9618049ee diff --git a/ccan/tdb2/test/run-12-store.c b/ccan/tdb2/test/run-12-store.c index 2cc3e86b..5c21e3a1 100644 --- a/ccan/tdb2/test/run-12-store.c +++ b/ccan/tdb2/test/run-12-store.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -15,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; @@ -50,10 +44,10 @@ int main(int argc, char *argv[]) /* We seemed to lose some keys. * Insert and check they're in there! */ for (j = 0; j < 500; j++) { - struct tdb_data d; + 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);