tdb2: unify tdb1_store into tdb_store
[ccan] / ccan / tdb2 / test / run-tdb1-summary.c
index 8b9b74ffe764802107af33aa767a4d43fb545206..5107b8e4363616569d7b83e432bcd1e8c07892f9 100644 (file)
@@ -16,8 +16,8 @@ int main(int argc, char *argv[])
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 14);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
 
        plan_tests(sizeof(flags) / sizeof(flags[0]) * 14);
        for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
-               tdb = tdb1_open("run-summary.tdb", 131, flags[i],
-                               O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
+               tdb = tdb_open("run-summary.tdb1", flags[i]|TDB_VERSION1,
+                              O_RDWR|O_CREAT|O_TRUNC, 0600, NULL);
                ok1(tdb);
                if (!tdb)
                        continue;
                ok1(tdb);
                if (!tdb)
                        continue;
@@ -26,8 +26,10 @@ int main(int argc, char *argv[])
                for (j = 0; j < 500; j++) {
                        /* Make sure padding varies to we get some graphs! */
                        data.dsize = j % (sizeof(j) + 1);
                for (j = 0; j < 500; j++) {
                        /* Make sure padding varies to we get some graphs! */
                        data.dsize = j % (sizeof(j) + 1);
-                       if (tdb1_store(tdb, key, data, TDB_REPLACE) != 0)
+                       if (tdb_store(tdb, key, data, TDB_REPLACE)
+                           != TDB_SUCCESS) {
                                fail("Storing in tdb");
                                fail("Storing in tdb");
+                       }
                }
 
                summary = tdb1_summary(tdb);
                }
 
                summary = tdb1_summary(tdb);
@@ -47,7 +49,7 @@ int main(int argc, char *argv[])
                ok1(strstr(summary, "Percentage keys/data/padding/free/dead/rechdrs&tailers/hashes: "));
 
                free(summary);
                ok1(strstr(summary, "Percentage keys/data/padding/free/dead/rechdrs&tailers/hashes: "));
 
                free(summary);
-               tdb1_close(tdb);
+               tdb_close(tdb);
        }
 
        return exit_status();
        }
 
        return exit_status();