tdb tools: Mostly cosmetic adaptions
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Fri, 16 Oct 2009 17:02:02 +0000 (19:02 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 16 Dec 2009 07:03:54 +0000 (08:03 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from samba commit 9776cb03450d21da5d454e683bdba29793ba3f67)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/tdb/tools/tdbdump.c
lib/tdb/tools/tdbtool.c

index 8d930383b0918cc94ff2602f0685c95073273699..027fda3d424209c6aff2af6ce9df540546a46850 100644 (file)
@@ -65,8 +65,8 @@ static int dump_tdb(const char *fname, const char *keyname)
        if (!keyname) {
                tdb_traverse(tdb, traverse_fn, NULL);
        } else {
-               key.dptr = discard_const_p(uint8_t,keyname);
-               key.dsize = strlen( keyname);
+               key.dptr = discard_const_p(uint8_t, keyname);
+               key.dsize = strlen(keyname);
                value = tdb_fetch(tdb, key);
                if (!value.dptr) {
                        return 1;
index d646515a04662ad7ae4d613c00f9c38f3f11b7e7..b380883e0ac247e18b4b324fd50cdd6e8e4830d0 100644 (file)
@@ -419,6 +419,7 @@ static void info_tdb(void)
 
 static void speed_tdb(const char *tlimit)
 {
+       const char *str = "store test", *str2 = "transaction test";
        unsigned timelimit = tlimit?atoi(tlimit):0;
        double t;
        int ops;
@@ -430,9 +431,9 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
-               key.dptr = (unsigned char *)"store test";
+               key.dptr = discard_const_p(uint8_t, str);
                key.dsize = strlen((char *)key.dptr);
-               dbuf.dptr = (unsigned char *)&r;
+               dbuf.dptr = (uint8_t *) &r;
                dbuf.dsize = sizeof(r);
                tdb_store(tdb, key, dbuf, TDB_REPLACE);
                t = _end_timer();
@@ -446,9 +447,9 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
-               key.dptr = (unsigned char *)"store test";
+               key.dptr = discard_const_p(uint8_t, str);
                key.dsize = strlen((char *)key.dptr);
-               dbuf.dptr = (unsigned char *)&r;
+               dbuf.dptr = (uint8_t *) &r;
                dbuf.dsize = sizeof(r);
                tdb_fetch(tdb, key);
                t = _end_timer();
@@ -462,9 +463,9 @@ static void speed_tdb(const char *tlimit)
        do {
                long int r = random();
                TDB_DATA key, dbuf;
-               key.dptr = (unsigned char *)"transaction test";
+               key.dptr = discard_const_p(uint8_t, str2);
                key.dsize = strlen((char *)key.dptr);
-               dbuf.dptr = (unsigned char *)&r;
+               dbuf.dptr = (uint8_t *) &r;
                dbuf.dsize = sizeof(r);
                tdb_transaction_start(tdb);
                tdb_store(tdb, key, dbuf, TDB_REPLACE);