rgw/rgw_admin.cc: prevent useless value assignment

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>
This commit is contained in:
Danny Al-Gaaf 2013-02-13 15:42:58 +01:00 committed by Greg Farnum
parent c115bdb495
commit 8c1cb21598

View 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;