tdb2: change API to return the error value.
[ccan] / ccan / tdb2 / _info
index 53dd1ce2d53baacf39e8764c97a5d0bf95ec6ff4..114b60b2182c7daefbaf585b15c9d9f3a2cc2033 100644 (file)
@@ -24,7 +24,8 @@
  *     {
  *             struct tdb_context *tdb;
  *             TDB_DATA key, value;
- *     
+ *             enum TDB_ERROR error;
+ *
  *             if (argc < 4)
  *                     usage(argv[0]);
  *     
  *             if (streq(argv[1], "fetch")) {
  *                     if (argc != 4)
  *                             usage(argv[0]);
- *                     value = tdb_fetch(tdb, key);
- *                     if (!value.dptr)
+ *                     error = tdb_fetch(tdb, key, &value);
+ *                     if (error)
  *                             errx(1, "fetch %s: %s",
- *                                  argv[3], tdb_errorstr(tdb));
+ *                                  argv[3], tdb_errorstr(error));
  *                     printf("%.*s\n", value.dsize, (char *)value.dptr);
  *                     free(value.dptr);
  *             } else if (streq(argv[1], "store")) {
  *                             usage(argv[0]);
  *                     value.dptr = (void *)argv[4];
  *                     value.dsize = strlen(argv[4]);
- *                     if (tdb_store(tdb, key, value, 0) != 0)
+ *                     error = tdb_store(tdb, key, value, 0);
+ *                     if (error)
  *                             errx(1, "store %s: %s",
- *                                  argv[3], tdb_errorstr(tdb));
+ *                                  argv[3], tdb_errorstr(error));
  *             } else
  *                     usage(argv[0]);
  *     
@@ -66,7 +68,7 @@
  *
  * Ccanlint:
  *     // hash fails because it accesses data in 4 byte quantities for speed.
- *     valgrind-tests --partial-loads-ok=yes
+ *     tests_pass_valgrind --partial-loads-ok=yes
  */
 int main(int argc, char *argv[])
 {
@@ -80,6 +82,7 @@ int main(int argc, char *argv[])
                printf("ccan/compiler\n");
                printf("ccan/build_assert\n");
                printf("ccan/ilog\n");
+               printf("ccan/failtest\n");
                printf("ccan/tally\n");
                return 0;
        }