]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/tdb1_tdb.c
tdb2: unify tdb1_store into tdb_store
[ccan] / ccan / tdb2 / tdb1_tdb.c
index bba16338e97ec937dd66d1b41e1ac0e02eb96003..2c989bb9a4fb16a3a1db501fd76c87d4f43a8461 100644 (file)
@@ -275,6 +275,7 @@ int tdb1_exists(struct tdb_context *tdb, TDB_DATA key)
        uint32_t hash = tdb_hash(tdb, key.dptr, key.dsize);
        int ret;
 
+       assert(tdb->flags & TDB_VERSION1);
        ret = tdb1_exists_hash(tdb, key, hash);
        return ret;
 }
@@ -434,6 +435,7 @@ int tdb1_delete(struct tdb_context *tdb, TDB_DATA key)
        uint32_t hash = tdb_hash(tdb, key.dptr, key.dsize);
        int ret;
 
+       assert(tdb->flags & TDB_VERSION1);
        ret = tdb1_delete_hash(tdb, key, hash);
        return ret;
 }
@@ -627,6 +629,8 @@ int tdb1_append(struct tdb_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
        TDB_DATA dbuf;
        int ret = -1;
 
+       assert(tdb->flags & TDB_VERSION1);
+
        /* find which hash bucket it is in */
        hash = tdb_hash(tdb, key.dptr, key.dsize);
        if (tdb1_lock(tdb, TDB1_BUCKET(hash), F_WRLCK) == -1)