core: Removing duplicated code
authorErwan Velu <erwan@enovance.com>
Mon, 22 Jul 2013 21:39:18 +0000 (23:39 +0200)
committerErwan Velu <erwan@enovance.com>
Mon, 22 Jul 2013 21:39:18 +0000 (23:39 +0200)
Some variable are assigned during initialization and another time with
the same value a very few later.

That's clearly useless and could lead to an error if only one is changed.

init.c
stat.c

diff --git a/init.c b/init.c
index 70b56e3..d808eb6 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1755,8 +1755,6 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                case FIO_GETOPT_IOENGINE: {
                        const char *opt = l_opts[lidx].name;
                        char *val = optarg;
-                       opt = l_opts[lidx].name;
-                       val = optarg;
                        ret = fio_cmd_ioengine_option_parse(td, opt, val);
                        break;
                }
diff --git a/stat.c b/stat.c
index 332ccd0..442caa0 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -243,15 +243,13 @@ out:
 int calc_lat(struct io_stat *is, unsigned long *min, unsigned long *max,
             double *mean, double *dev)
 {
-       double n = is->samples;
+       double n = (double) is->samples;
 
-       if (is->samples == 0)
+       if (n == 0)
                return 0;
 
        *min = is->min_val;
        *max = is->max_val;
-
-       n = (double) is->samples;
        *mean = is->mean.u.f;
 
        if (n > 1.0)