Fixup -Wshadow warnings
[fio.git] / stat.c
diff --git a/stat.c b/stat.c
index 3d7dcde10681a99dd56a6a8dd2663cf774aae4e7..091d6fb1dd1e6a66daa7c0c306737fa2f8312e64 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -1083,9 +1083,10 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
 
        /* ETA Info */
        je = get_jobs_eta(1, &size);
-       json_object_add_value_int(root, "eta", je->eta_sec);
-       json_object_add_value_int(root, "elapsed", je->elapsed_sec);
-
+       if (je) {
+               json_object_add_value_int(root, "eta", je->eta_sec);
+               json_object_add_value_int(root, "elapsed", je->elapsed_sec);
+       }
 
        add_ddir_status_json(ts, rs, DDIR_READ, root);
        add_ddir_status_json(ts, rs, DDIR_WRITE, root);
@@ -1172,7 +1173,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts,
 
                if (len) {
                        struct json_object *block, *percentile_object, *states;
-                       int state, i;
+                       int state;
                        block = json_create_object();
                        json_object_add_value_object(root, "block", block);
 
@@ -1400,8 +1401,6 @@ void __show_run_stats(void)
 
        runstats = malloc(sizeof(struct group_run_stats) * (groupid + 1));
 
-       memset(output, 0, sizeof(output));
-
        for (i = 0; i < groupid + 1; i++)
                init_group_run_stat(&runstats[i]);
 
@@ -1560,7 +1559,7 @@ void __show_run_stats(void)
        }
 
        for (i = 0; i < FIO_OUTPUT_NR; i++)
-               buf_output_init(&output[i], i);
+               buf_output_init(&output[i]);
 
        /*
         * don't overwrite last signal output
@@ -1629,15 +1628,14 @@ void __show_run_stats(void)
                show_idle_prof_stats(FIO_OUTPUT_NORMAL, NULL, &output[__FIO_OUTPUT_NORMAL]);
        }
 
-       for (i = 0; i < FIO_OUTPUT_NR; i++)
+       for (i = 0; i < FIO_OUTPUT_NR; i++) {
                buf_output_flush(&output[i]);
+               buf_output_free(&output[i]);
+       }
 
        log_info_flush();
        free(runstats);
        free(threadstats);
-
-       for (i = 0; i < FIO_OUTPUT_NR; i++)
-               buf_output_free(&output[i]);
 }
 
 void show_run_stats(void)