]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Objecter.cc: prevent useless value assignment
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 14:30:19 +0000 (15:30 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:19:53 +0000 (10:19 -0800)
Fix issue found by cppcheck:
[src/osdc/Objecter.cc:989] -> [src/osdc/Objecter.cc:992]: (performance)
  Variable 'check_for_latest_map' is reassigned a value before the old
  one has been used.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix it by declaring at the first real definition.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/osdc/Objecter.cc

index 7b45dcdb200458aa0b2ccc0b4eef9b4ee9d2ccf6..21d9df7f3d694c7fc083cd14051b3acd06961175 100644 (file)
@@ -986,10 +986,9 @@ tid_t Objecter::_op_submit(Op *op)
   assert(client_inc >= 0);
 
   // pick target
-  bool check_for_latest_map = false;
   num_homeless_ops++;  // initially; recalc_op_target() will decrement if it finds a target
   int r = recalc_op_target(op);
-  check_for_latest_map = (r == RECALC_OP_TARGET_POOL_DNE);
+  bool check_for_latest_map = (r == RECALC_OP_TARGET_POOL_DNE);
 
   // add to gather set(s)
   if (op->onack) {