From ee0ccb794be1d3c677e2c02b416a8702d59811d7 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 22 Jul 2013 23:39:18 +0200 Subject: [PATCH] core: Removing duplicated code 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 | 2 -- stat.c | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/init.c b/init.c index 70b56e38..d808eb67 100644 --- 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 332ccd0f..442caa0c 100644 --- 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) -- 2.25.1