From 8c1cb21598e603f39026f84acec84866cb4451df Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Wed, 13 Feb 2013 15:42:58 +0100 Subject: [PATCH] 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 Deal with this by moving the declaration to where we define the value for a couple variables. Signed-off-by: Greg Farnum --- src/rgw/rgw_admin.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index bcb52c4420b..febdfc46099 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -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 stats; std::vector 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;