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

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Deal with this by moving the declaration to where we define
the value for a couple variables.

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

index bcb52c4420be4e5d4da87f43f2ca8128135c3281..febdfc460990b4498dbf5ce6f17401e743510887 100644 (file)
@@ -707,18 +707,16 @@ static void check_bad_user_bucket_mapping(RGWRados *store, const string& user_id
 
 static int remove_object(RGWRados *store, rgw_bucket& bucket, std::string& object)
 {
-  int ret = -EINVAL;
   RGWRadosCtx *rctx = new RGWRadosCtx(store);
   rgw_obj obj(bucket,object);
 
-  ret = store->delete_obj(rctx, obj);
+  int ret = store->delete_obj(rctx, obj);
 
   return ret;
 }
 
 static int remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_children)
 {
-  int ret;
   map<RGWObjCategory, RGWBucketStats> stats;
   std::vector<RGWObjEnt> objs;
   std::string prefix, delim, marker, ns;
@@ -727,7 +725,8 @@ static int remove_bucket(RGWRados *store, rgw_bucket& bucket, bool delete_childr
   RGWBucketInfo info;
   bufferlist bl;
 
-  ret = store->get_bucket_stats(bucket, stats);
+  int ret = store->get_bucket_stats(bucket, stats);
+
   if (ret < 0)
     return ret;