Objecter::calc_target(): init best_locality with 0

Init best_locality to fix:

osdc/Objecter.cc:1519:26: warning: variable 'best_locality' may be
 uninitialized when used here [-Wconditional-uninitialized]
              (locality >= 0 && best_locality >= 0 &&
                                ^~~~~~~~~~~~~
osdc/Objecter.cc:1511:19: note: initialize the variable 'best_locality'
 to silence this warning
        int best_locality;
                         ^
                          = 0

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
Danny Al-Gaaf 2014-05-08 15:47:08 +02:00
parent b4b79ebbec
commit 8322878c22

View File

@ -1508,7 +1508,7 @@ int Objecter::calc_target(op_target_t *t)
// look for a local replica. prefer the primary if the
// distance is the same.
int best = -1;
int best_locality;
int best_locality = 0;
for (unsigned i = 0; i < acting.size(); ++i) {
int locality = osdmap->crush->get_common_ancestor_distance(
cct, acting[i], crush_location);