]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_user.cc:
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sun, 11 May 2014 09:28:26 +0000 (11:28 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Sun, 11 May 2014 09:28:26 +0000 (11:28 +0200)
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 <danny.al-gaaf@bisect.de>
src/rgw/rgw_user.cc

index 23575d8a0cb3b41afa56d771bd985f38c1c93546..ceede64b43736a814645edd44cf4a405e33f2eb5 100644 (file)
@@ -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");