From 36c1c974aa9eac28371a2cec4ff6e76791b7ff29 Mon Sep 17 00:00:00 2001 From: Danny Al-Gaaf Date: Sun, 11 May 2014 11:28:26 +0200 Subject: [PATCH] rgw_user.cc: Remove bool variable 'same_email' compare emails directly in if check. Fix for: [src/rgw/rgw_user.cc:1926] -> [src/rgw/rgw_user.cc:1927]: (performance) Variable 'same_email' is reassigned a value before the old one has been used. Signed-off-by: Danny Al-Gaaf --- src/rgw/rgw_user.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/rgw/rgw_user.cc b/src/rgw/rgw_user.cc index 23575d8a0cb3b..ceede64b43736 100644 --- a/src/rgw/rgw_user.cc +++ b/src/rgw/rgw_user.cc @@ -1923,11 +1923,8 @@ int RGWUser::execute_modify(RGWUserAdminOpState& op_state, std::string *err_msg) std::string old_email = old_info.user_email; if (!op_email.empty()) { - bool same_email = false; - same_email = (old_email.compare(op_email) == 0); - // make sure we are not adding a duplicate email - if (!same_email) { + if (old_email.compare(op_email) != 0) { ret = rgw_get_user_info_by_email(store, op_email, duplicate_check); if (ret >= 0 && duplicate_check.user_id != user_id) { set_err_msg(err_msg, "cannot add duplicate email"); -- 2.39.5