]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/tools/tdbtool.c
tdb2: fix tools warnings with -Wshadow and -Wcast-qual.
[ccan] / ccan / tdb2 / tools / tdbtool.c
index 3ae7866d2c63c6137bd7cb1f59ac64bc35cbd761..15ae052c4b2e3480b41a3eef9f283730146904b0 100644 (file)
@@ -21,7 +21,6 @@
 */
 
 #include <ccan/tdb2/tdb2.h>
-#include <ccan/hash/hash.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
@@ -207,8 +206,10 @@ static void help(void)
 "  store     key  data  : store a record (replace)\n"
 "  show      key        : show a record by key\n"
 "  delete    key        : delete a record by key\n"
+#if 0
 "  list                 : print the database hash table and freelist\n"
 "  free                 : print the database freelist\n"
+#endif
 "  check                : check the integrity of an opened database\n"
 "  speed                : perform speed tests on the database\n"
 "  ! command            : execute system command\n"
@@ -242,12 +243,6 @@ static void create_tdb(const char *tdbname)
        }
 }
 
-static uint64_t jenkins_hash(const void *key, size_t len, uint64_t seed,
-                            void *priv)
-{
-       return hash_any(key, len, seed);
-}
-
 static void open_tdb(const char *tdbname)
 {
        union tdb_attribute log_attr;
@@ -459,8 +454,7 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
-               key.dptr = (unsigned char *)"store test";
-               key.dsize = strlen((char *)key.dptr);
+               key = tdb_mkdata("store test", strlen("store test"));
                dbuf.dptr = (unsigned char *)&r;
                dbuf.dsize = sizeof(r);
                tdb_store(tdb, key, dbuf, TDB_REPLACE);
@@ -475,8 +469,7 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
-               key.dptr = (unsigned char *)"store test";
-               key.dsize = strlen((char *)key.dptr);
+               key = tdb_mkdata("store test", strlen("store test"));
                dbuf.dptr = (unsigned char *)&r;
                dbuf.dsize = sizeof(r);
                tdb_fetch(tdb, key, &dbuf);
@@ -491,8 +484,7 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
-               key.dptr = (unsigned char *)"transaction test";
-               key.dsize = strlen((char *)key.dptr);
+               key = tdb_mkdata("transaction test", strlen("transaction test"));
                dbuf.dptr = (unsigned char *)&r;
                dbuf.dsize = sizeof(r);
                tdb_transaction_start(tdb);