s4:torture/local: only pass prefix strings to tdb_add_record() in dbspeed.c
authorStefan Metzmacher <metze@samba.org>
Thu, 27 Feb 2014 08:08:17 +0000 (09:08 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 2 Apr 2014 07:03:45 +0000 (09:03 +0200)
This way the compiler has a chance to check the format string.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/local/dbspeed.c

index e0c132e3f28185e77f0878d627a2dae22b016dfd..1800ace04f0aab0036a38e07b8afbd56b065a827 100644 (file)
 
 float tdb_speed;
 
-static bool tdb_add_record(struct tdb_wrap *tdbw, const char *fmt1, 
-                          const char *fmt2, int i)
+static bool tdb_add_record(struct tdb_wrap *tdbw, const char *p1,
+                          const char *p2, int i)
 {
        TDB_DATA key, data;
        int ret;
 
-       key.dptr = (uint8_t *)talloc_asprintf(tdbw, fmt1, i);
+       key.dptr = (uint8_t *)talloc_asprintf(tdbw, "%s%u", p1, i);
        key.dsize = strlen((char *)key.dptr)+1;
-       data.dptr = (uint8_t *)talloc_asprintf(tdbw, fmt2, i+10000);
+       data.dptr = (uint8_t *)talloc_asprintf(tdbw, "%s%u", p2, i+10000);
        data.dsize = strlen((char *)data.dptr)+1;
 
        ret = tdb_store(tdbw->tdb, key, data, TDB_INSERT);
@@ -77,14 +77,14 @@ static bool test_tdb_speed(struct torture_context *torture, const void *_data)
 
        for (i=0;i<torture_entries;i++) {
                if (!tdb_add_record(tdbw, 
-                                   "S-1-5-21-53173311-3623041448-2049097239-%u",
-                                   "UID %u", i)) {
+                                   "S-1-5-21-53173311-3623041448-2049097239-",
+                                   "UID ", i)) {
                        torture_result(torture, TORTURE_FAIL, "Failed to add SID %d!", i);
                        goto failed;
                }
                if (!tdb_add_record(tdbw, 
-                                   "UID %u",
-                                   "S-1-5-21-53173311-3623041448-2049097239-%u", i)) {
+                                   "UID ",
+                                   "S-1-5-21-53173311-3623041448-2049097239-", i)) {
                        torture_result(torture, TORTURE_FAIL, "Failed to add UID %d!", i);
                        goto failed;
                }