Initialize variables before using them

Avoid a compiler warning when using the average, minimum, and maximum
elapsed variables without initializing them.

https://bugzilla.gnome.org/show_bug.cgi?id=794732
This commit is contained in:
Emmanuele Bassi 2018-03-27 16:41:40 +01:00
parent 327c379862
commit 94d4e8b2fb

View File

@ -125,6 +125,9 @@ run_test (PerformanceTest *test)
g_print ("Running %"G_GINT64_MODIFIER"d rounds\n", num_rounds);
/* Run the test */
avg_elapsed = 0.0;
min_elapsed = 0.0;
max_elapsed = 0.0;
for (i = 0; i < num_rounds; i++)
{
test->init (test, data, factor);
@ -144,7 +147,8 @@ run_test (PerformanceTest *test)
}
}
avg_elapsed = avg_elapsed / num_rounds;
if (num_rounds > 1)
avg_elapsed = avg_elapsed / num_rounds;
if (verbose)
{
@ -152,6 +156,7 @@ run_test (PerformanceTest *test)
g_print ("Maximum corrected round time: %.2f msecs\n", max_elapsed * 1000);
g_print ("Average corrected round time: %.2f msecs\n", avg_elapsed * 1000);
}
/* Print the results */
test->print_result (test, data, min_elapsed);