tdb2: fix tools warnings with -Wshadow and -Wcast-qual.
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 23 Mar 2011 05:02:01 +0000 (15:32 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 23 Mar 2011 05:02:01 +0000 (15:32 +1030)
Samba uses these flags, so be friendly.

ccan/tdb2/tools/tdbtool.c
ccan/tdb2/tools/tdbtorture.c

index a00ebb904b9ac37b13e7f086ccc38e8409dc4199..15ae052c4b2e3480b41a3eef9f283730146904b0 100644 (file)
@@ -454,8 +454,7 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
        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);
                dbuf.dptr = (unsigned char *)&r;
                dbuf.dsize = sizeof(r);
                tdb_store(tdb, key, dbuf, TDB_REPLACE);
@@ -470,8 +469,7 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
        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);
                dbuf.dptr = (unsigned char *)&r;
                dbuf.dsize = sizeof(r);
                tdb_fetch(tdb, key, &dbuf);
@@ -486,8 +484,7 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
        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);
                dbuf.dptr = (unsigned char *)&r;
                dbuf.dsize = sizeof(r);
                tdb_transaction_start(tdb);
index 52cab665d1393e63a8839dc3ad17619915db4a54..c6b71de51c407d6aaa8aa90da4a8bad60769479f 100644 (file)
@@ -60,7 +60,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_log_level level,
 
 #include "../private.h"
 
 
 #include "../private.h"
 
-static void segv_handler(int signal, siginfo_t *info, void *p)
+static void segv_handler(int sig, siginfo_t *info, void *p)
 {
        char string[100];
 
 {
        char string[100];