diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-12-30 22:42:04 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-12-30 22:42:04 +0000 |
commit | 416c2f5a713b93ba689a8cd1e038682a53e6bc17 (patch) | |
tree | 987f51d9edfddc02afe1524df5e1156b920c71d4 /src/datastore | |
parent | fceec98e767bce7ad2c24dde73cdcf8837e04013 (diff) | |
download | gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.tar.gz gnunet-416c2f5a713b93ba689a8cd1e038682a53e6bc17.zip |
-LRN: use FPRINTF -- #2051
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/perf_datastore_api.c | 10 | ||||
-rw-r--r-- | src/datastore/perf_plugin_datastore.c | 14 | ||||
-rw-r--r-- | src/datastore/test_datastore_api.c | 12 | ||||
-rw-r--r-- | src/datastore/test_datastore_api_management.c | 6 | ||||
-rw-r--r-- | src/datastore/test_plugin_datastore.c | 16 |
5 files changed, 29 insertions, 29 deletions
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 372a61f7d..106d40684 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -123,7 +123,7 @@ check_success (void *cls, int success, struct GNUNET_TIME_Absolute min_expiratio | |||
123 | return; | 123 | return; |
124 | } | 124 | } |
125 | #if REPORT_ID | 125 | #if REPORT_ID |
126 | fprintf (stderr, "I"); | 126 | FPRINTF (stderr, "%s", "I"); |
127 | #endif | 127 | #endif |
128 | stored_bytes += crc->size; | 128 | stored_bytes += crc->size; |
129 | stored_ops++; | 129 | stored_ops++; |
@@ -166,7 +166,7 @@ remove_next (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, | |||
166 | return; | 166 | return; |
167 | } | 167 | } |
168 | #if REPORT_ID | 168 | #if REPORT_ID |
169 | fprintf (stderr, "D"); | 169 | FPRINTF (stderr, "%s", "D"); |
170 | #endif | 170 | #endif |
171 | GNUNET_assert (GNUNET_OK == success); | 171 | GNUNET_assert (GNUNET_OK == success); |
172 | GNUNET_SCHEDULER_add_now (&run_continuation, crc); | 172 | GNUNET_SCHEDULER_add_now (&run_continuation, crc); |
@@ -284,7 +284,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c | |||
284 | 284 | ||
285 | if (success != GNUNET_YES) | 285 | if (success != GNUNET_YES) |
286 | { | 286 | { |
287 | fprintf (stderr, | 287 | FPRINTF (stderr, |
288 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.", | 288 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.", |
289 | msg); | 289 | msg); |
290 | GNUNET_free (crc); | 290 | GNUNET_free (crc); |
@@ -314,7 +314,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
314 | (GNUNET_TIME_UNIT_SECONDS), 0, 1, | 314 | (GNUNET_TIME_UNIT_SECONDS), 0, 1, |
315 | GNUNET_TIME_UNIT_MINUTES, &run_tests, crc)) | 315 | GNUNET_TIME_UNIT_MINUTES, &run_tests, crc)) |
316 | { | 316 | { |
317 | fprintf (stderr, "Test 'put' operation failed.\n"); | 317 | FPRINTF (stderr, "%s", "Test 'put' operation failed.\n"); |
318 | ok = 1; | 318 | ok = 1; |
319 | GNUNET_free (crc); | 319 | GNUNET_free (crc); |
320 | } | 320 | } |
@@ -396,7 +396,7 @@ main (int argc, char *argv[]) | |||
396 | if (pos != plugin_name) | 396 | if (pos != plugin_name) |
397 | pos[0] = '.'; | 397 | pos[0] = '.'; |
398 | #if REPORT_ID | 398 | #if REPORT_ID |
399 | fprintf (stderr, "\n"); | 399 | FPRINTF (stderr, "%s", "\n"); |
400 | #endif | 400 | #endif |
401 | GNUNET_DISK_directory_remove (dir_name); | 401 | GNUNET_DISK_directory_remove (dir_name); |
402 | return ret; | 402 | return ret; |
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 8f552c4eb..6106b11cb 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -135,7 +135,7 @@ putValue (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k) | |||
135 | GNUNET_CRYPTO_random_u32 | 135 | GNUNET_CRYPTO_random_u32 |
136 | (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), &msg)) | 136 | (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), &msg)) |
137 | { | 137 | { |
138 | fprintf (stderr, "ERROR: `%s'\n", msg); | 138 | FPRINTF (stderr, "ERROR: `%s'\n", msg); |
139 | GNUNET_free_non_null (msg); | 139 | GNUNET_free_non_null (msg); |
140 | return; | 140 | return; |
141 | } | 141 | } |
@@ -165,7 +165,7 @@ iterate_zeros (void *cls, const GNUNET_HashCode * key, uint32_t size, | |||
165 | hits[i / 8] |= (1 << (i % 8)); | 165 | hits[i / 8] |= (1 << (i % 8)); |
166 | 166 | ||
167 | #if VERBOSE | 167 | #if VERBOSE |
168 | fprintf (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n", | 168 | FPRINTF (stderr, "Found result type=%u, priority=%u, size=%u, expire=%llu\n", |
169 | type, priority, size, (unsigned long long) expiration.abs_value); | 169 | type, priority, size, (unsigned long long) expiration.abs_value); |
170 | #endif | 170 | #endif |
171 | crc->cnt++; | 171 | crc->cnt++; |
@@ -344,7 +344,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
344 | crc->phase = RP_ERROR; | 344 | crc->phase = RP_ERROR; |
345 | } | 345 | } |
346 | #if VERBOSE | 346 | #if VERBOSE |
347 | fprintf (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt); | 347 | FPRINTF (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt); |
348 | #endif | 348 | #endif |
349 | switch (crc->phase) | 349 | switch (crc->phase) |
350 | { | 350 | { |
@@ -422,7 +422,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
422 | GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name); | 422 | GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name); |
423 | if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env))) | 423 | if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env))) |
424 | { | 424 | { |
425 | fprintf (stderr, "Failed to load plugin `%s'!\n", name); | 425 | FPRINTF (stderr, "Failed to load plugin `%s'!\n", name); |
426 | return NULL; | 426 | return NULL; |
427 | } | 427 | } |
428 | GNUNET_free (libname); | 428 | GNUNET_free (libname); |
@@ -441,8 +441,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
441 | api = load_plugin (c); | 441 | api = load_plugin (c); |
442 | if (api == NULL) | 442 | if (api == NULL) |
443 | { | 443 | { |
444 | fprintf (stderr, | 444 | FPRINTF (stderr, |
445 | "Could not initialize plugin, assuming database not configured. Test not run!\n"); | 445 | "Could not initialize plugin, assuming database not configured. Test not run!\n", NULL); |
446 | return; | 446 | return; |
447 | } | 447 | } |
448 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 448 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); |
@@ -478,7 +478,7 @@ check () | |||
478 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 478 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
479 | "perf-plugin-datastore", "nohelp", options, &run, NULL); | 479 | "perf-plugin-datastore", "nohelp", options, &run, NULL); |
480 | if (ok != 0) | 480 | if (ok != 0) |
481 | fprintf (stderr, "Missed some testcases: %u\n", ok); | 481 | FPRINTF (stderr, "Missed some testcases: %u\n", ok); |
482 | return ok; | 482 | return ok; |
483 | } | 483 | } |
484 | 484 | ||
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index 942e0a11e..df6d3af62 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -193,10 +193,10 @@ check_value (void *cls, const GNUNET_HashCode * key, size_t size, | |||
193 | return; | 193 | return; |
194 | } | 194 | } |
195 | #if 0 | 195 | #if 0 |
196 | fprintf (stderr, "Check value got `%s' of size %u, type %d, expire %llu\n", | 196 | FPRINTF (stderr, "Check value got `%s' of size %u, type %d, expire %llu\n", |
197 | GNUNET_h2s (key), (unsigned int) size, type, | 197 | GNUNET_h2s (key), (unsigned int) size, type, |
198 | (unsigned long long) expiration.abs_value); | 198 | (unsigned long long) expiration.abs_value); |
199 | fprintf (stderr, | 199 | FPRINTF (stderr, |
200 | "Check value iteration %d wants size %u, type %d, expire %llu\n", i, | 200 | "Check value iteration %d wants size %u, type %d, expire %llu\n", i, |
201 | (unsigned int) get_size (i), get_type (i), | 201 | (unsigned int) get_size (i), get_type (i), |
202 | (unsigned long long) get_expiration (i).abs_value); | 202 | (unsigned long long) get_expiration (i).abs_value); |
@@ -461,11 +461,11 @@ run_tests (void *cls, int32_t success, struct GNUNET_TIME_Absolute min_expiratio | |||
461 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | 461 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); |
462 | return; | 462 | return; |
463 | case GNUNET_NO: | 463 | case GNUNET_NO: |
464 | fprintf (stderr, "Test 'put' operation failed, key already exists (!?)\n"); | 464 | FPRINTF (stderr, "%s", "Test 'put' operation failed, key already exists (!?)\n"); |
465 | GNUNET_free (crc); | 465 | GNUNET_free (crc); |
466 | return; | 466 | return; |
467 | case GNUNET_SYSERR: | 467 | case GNUNET_SYSERR: |
468 | fprintf (stderr, | 468 | FPRINTF (stderr, |
469 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.\n", | 469 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.\n", |
470 | msg); | 470 | msg); |
471 | GNUNET_free (crc); | 471 | GNUNET_free (crc); |
@@ -495,7 +495,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
495 | (GNUNET_TIME_UNIT_SECONDS), 0, 1, | 495 | (GNUNET_TIME_UNIT_SECONDS), 0, 1, |
496 | GNUNET_TIME_UNIT_MINUTES, &run_tests, crc)) | 496 | GNUNET_TIME_UNIT_MINUTES, &run_tests, crc)) |
497 | { | 497 | { |
498 | fprintf (stderr, "Test 'put' operation failed.\n"); | 498 | FPRINTF (stderr, "%s", "Test 'put' operation failed.\n"); |
499 | ok = 1; | 499 | ok = 1; |
500 | GNUNET_free (crc); | 500 | GNUNET_free (crc); |
501 | } | 501 | } |
@@ -548,7 +548,7 @@ check () | |||
548 | proc = NULL; | 548 | proc = NULL; |
549 | #endif | 549 | #endif |
550 | if (ok != 0) | 550 | if (ok != 0) |
551 | fprintf (stderr, "Missed some testcases: %u\n", ok); | 551 | FPRINTF (stderr, "Missed some testcases: %u\n", ok); |
552 | return ok; | 552 | return ok; |
553 | } | 553 | } |
554 | 554 | ||
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 3cb8ed94a..20a405d07 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -252,7 +252,7 @@ run_tests (void *cls, int success, struct GNUNET_TIME_Absolute min_expiration, c | |||
252 | 252 | ||
253 | if (success != GNUNET_YES) | 253 | if (success != GNUNET_YES) |
254 | { | 254 | { |
255 | fprintf (stderr, | 255 | FPRINTF (stderr, |
256 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.", | 256 | "Test 'put' operation failed with error `%s' database likely not setup, skipping test.", |
257 | msg); | 257 | msg); |
258 | GNUNET_free (crc); | 258 | GNUNET_free (crc); |
@@ -282,7 +282,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
282 | (GNUNET_TIME_UNIT_SECONDS), 0, 1, | 282 | (GNUNET_TIME_UNIT_SECONDS), 0, 1, |
283 | GNUNET_TIME_UNIT_MINUTES, &run_tests, crc)) | 283 | GNUNET_TIME_UNIT_MINUTES, &run_tests, crc)) |
284 | { | 284 | { |
285 | fprintf (stderr, "Test 'put' operation failed.\n"); | 285 | FPRINTF (stderr, "%s", "Test 'put' operation failed.\n"); |
286 | GNUNET_free (crc); | 286 | GNUNET_free (crc); |
287 | ok = 1; | 287 | ok = 1; |
288 | } | 288 | } |
@@ -331,7 +331,7 @@ check () | |||
331 | GNUNET_OS_process_close (proc); | 331 | GNUNET_OS_process_close (proc); |
332 | proc = NULL; | 332 | proc = NULL; |
333 | if (ok != 0) | 333 | if (ok != 0) |
334 | fprintf (stderr, "Missed some testcases: %u\n", ok); | 334 | FPRINTF (stderr, "Missed some testcases: %u\n", ok); |
335 | return ok; | 335 | return ok; |
336 | } | 336 | } |
337 | 337 | ||
diff --git a/src/datastore/test_plugin_datastore.c b/src/datastore/test_plugin_datastore.c index 3504945ae..ca894ff33 100644 --- a/src/datastore/test_plugin_datastore.c +++ b/src/datastore/test_plugin_datastore.c | |||
@@ -118,7 +118,7 @@ put_value (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k) | |||
118 | msg = NULL; | 118 | msg = NULL; |
119 | prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100); | 119 | prio = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100); |
120 | #if VERBOSE | 120 | #if VERBOSE |
121 | fprintf (stderr, "putting type %u, anon %u under key %s\n", i + 1, i, | 121 | FPRINTF (stderr, "putting type %u, anon %u under key %s\n", i + 1, i, |
122 | GNUNET_h2s (&key)); | 122 | GNUNET_h2s (&key)); |
123 | #endif | 123 | #endif |
124 | if (GNUNET_OK != api->put (api->cls, &key, size, value, i + 1 /* type */ , | 124 | if (GNUNET_OK != api->put (api->cls, &key, size, value, i + 1 /* type */ , |
@@ -131,7 +131,7 @@ put_value (struct GNUNET_DATASTORE_PluginFunctions *api, int i, int k) | |||
131 | GNUNET_CRYPTO_random_u32 | 131 | GNUNET_CRYPTO_random_u32 |
132 | (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), &msg)) | 132 | (GNUNET_CRYPTO_QUALITY_WEAK, 1000))), &msg)) |
133 | { | 133 | { |
134 | fprintf (stderr, "ERROR: `%s'\n", msg); | 134 | FPRINTF (stderr, "ERROR: `%s'\n", msg); |
135 | GNUNET_free_non_null (msg); | 135 | GNUNET_free_non_null (msg); |
136 | return; | 136 | return; |
137 | } | 137 | } |
@@ -160,7 +160,7 @@ iterate_one_shot (void *cls, const GNUNET_HashCode * key, uint32_t size, | |||
160 | guid = uid; | 160 | guid = uid; |
161 | crc->phase++; | 161 | crc->phase++; |
162 | #if VERBOSE | 162 | #if VERBOSE |
163 | fprintf (stderr, | 163 | FPRINTF (stderr, |
164 | "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n", | 164 | "Found result type=%u, priority=%u, size=%u, expire=%llu, key %s\n", |
165 | type, priority, size, (unsigned long long) expiration.abs_value, | 165 | type, priority, size, (unsigned long long) expiration.abs_value, |
166 | GNUNET_h2s (key)); | 166 | GNUNET_h2s (key)); |
@@ -230,7 +230,7 @@ test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
230 | crc->phase = RP_ERROR; | 230 | crc->phase = RP_ERROR; |
231 | } | 231 | } |
232 | #if VERBOSE | 232 | #if VERBOSE |
233 | fprintf (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt); | 233 | FPRINTF (stderr, "In phase %d, iteration %u\n", crc->phase, crc->cnt); |
234 | #endif | 234 | #endif |
235 | switch (crc->phase) | 235 | switch (crc->phase) |
236 | { | 236 | { |
@@ -324,7 +324,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
324 | GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name); | 324 | GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name); |
325 | if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env))) | 325 | if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env))) |
326 | { | 326 | { |
327 | fprintf (stderr, "Failed to load plugin `%s'!\n", name); | 327 | FPRINTF (stderr, "Failed to load plugin `%s'!\n", name); |
328 | return NULL; | 328 | return NULL; |
329 | } | 329 | } |
330 | GNUNET_free (libname); | 330 | GNUNET_free (libname); |
@@ -343,8 +343,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
343 | api = load_plugin (c); | 343 | api = load_plugin (c); |
344 | if (api == NULL) | 344 | if (api == NULL) |
345 | { | 345 | { |
346 | fprintf (stderr, | 346 | FPRINTF (stderr, |
347 | "Could not initialize plugin, assuming database not configured. Test not run!\n"); | 347 | "Could not initialize plugin, assuming database not configured. Test not run!\n", NULL); |
348 | return; | 348 | return; |
349 | } | 349 | } |
350 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); | 350 | crc = GNUNET_malloc (sizeof (struct CpsRunContext)); |
@@ -378,7 +378,7 @@ check () | |||
378 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, | 378 | GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, |
379 | "test-plugin-datastore", "nohelp", options, &run, NULL); | 379 | "test-plugin-datastore", "nohelp", options, &run, NULL); |
380 | if (ok != 0) | 380 | if (ok != 0) |
381 | fprintf (stderr, "Missed some testcases: %u\n", ok); | 381 | FPRINTF (stderr, "Missed some testcases: %u\n", ok); |
382 | return ok; | 382 | return ok; |
383 | } | 383 | } |
384 | 384 | ||