X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Fhash.c;h=f8d6b5812ebfb5307e35f3203dbe0ded9abdbde5;hp=7c7843ec8474d1ac8d751d69b1bdae7652818ff0;hb=96b169e986cda1de9ffbbdc98042e1099515ca34;hpb=fe55330a60e4e14ea6cac2ff40d50eddca4cf140 diff --git a/ccan/tdb2/hash.c b/ccan/tdb2/hash.c index 7c7843ec..f8d6b581 100644 --- a/ccan/tdb2/hash.c +++ b/ccan/tdb2/hash.c @@ -42,17 +42,19 @@ uint64_t tdb_hash(struct tdb_context *tdb, const void *ptr, size_t len) uint64_t hash_record(struct tdb_context *tdb, tdb_off_t off) { - struct tdb_used_record pad, *r; + const struct tdb_used_record *r; const void *key; uint64_t klen, hash; - r = tdb_get(tdb, off, &pad, sizeof(pad)); + r = tdb_access_read(tdb, off, sizeof(*r), true); if (!r) /* FIXME */ return 0; klen = rec_key_length(r); - key = tdb_access_read(tdb, off + sizeof(pad), klen, false); + tdb_access_release(tdb, r); + + key = tdb_access_read(tdb, off + sizeof(*r), klen, false); if (!key) return 0;