diff options
author | Ben Pfaff <blp@nicira.com> | 2014-07-14 14:31:36 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2014-07-15 09:39:16 -0700 |
commit | e7dcae61f65f58efb5b56eaff161d7518328d64e (patch) | |
tree | 6df3fbdd93186181affdbce0865abba520779bd5 | |
parent | bfd3dbf6a0c978ceb20faf292bca513a63e2b68c (diff) | |
download | openvswitch-e7dcae61f65f58efb5b56eaff161d7518328d64e.tar.gz |
coverage: Move m_idx, h_idx to an inner scope in coverage_run().
These variables were initialized in an outer scope and then immediately
changed in an inner one, so they might as well be farther in.
Found by clang-analyzer.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
-rw-r--r-- | lib/coverage.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/coverage.c b/lib/coverage.c index cc17e342a..5a20d6ec3 100644 --- a/lib/coverage.c +++ b/lib/coverage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. + * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -300,8 +300,6 @@ coverage_run(void) for (i = 0; i < n_coverage_counters; i++) { unsigned int count, portion; - unsigned int m_idx = min_idx; - unsigned int h_idx = hr_idx; unsigned int idx = idx_count; /* Computes the differences between the current total and the one @@ -317,8 +315,8 @@ coverage_run(void) /* The m_idx is increased from 0 to MIN_AVG_LEN - 1. Every * time the m_idx finishes a cycle (a cycle is one minute), * the h_idx is incremented by 1. */ - m_idx = idx % MIN_AVG_LEN; - h_idx = idx / MIN_AVG_LEN; + unsigned int m_idx = idx % MIN_AVG_LEN; + unsigned int h_idx = idx / MIN_AVG_LEN; c[i]->min[m_idx] = portion + (j == (slots - 1) ? count % slots : 0); |