From ec7cead38aa29caf615f579fcf4aa0567c6ca938 Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Mon, 7 Nov 2016 16:33:20 -0500 Subject: [PATCH] rgw: Do not std::move to return locally constructed objects It prevents return value optimization. Signed-off-by: Adam C. Emerson --- src/rgw/rgw_b64.h | 4 ++-- src/rgw/rgw_ldap.cc | 2 +- src/rgw/rgw_token.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_b64.h b/src/rgw/rgw_b64.h index 36c984e815a..52374f49363 100644 --- a/src/rgw/rgw_b64.h +++ b/src/rgw/rgw_b64.h @@ -55,7 +55,7 @@ namespace rgw { for (size_t ix = 0; ix < (psize-sref.size()); ++ix) outstr.push_back('='); - return std::move(outstr); + return outstr; } inline std::string from_base64(boost::string_ref sref) @@ -78,7 +78,7 @@ namespace rgw { std::string outstr(b64_iter(sref.data()), b64_iter(sref.data() + sref.size())); - return std::move(outstr); + return outstr; } } /* namespace */ diff --git a/src/rgw/rgw_ldap.cc b/src/rgw/rgw_ldap.cc index e8915e30daf..d07b295153e 100644 --- a/src/rgw/rgw_ldap.cc +++ b/src/rgw/rgw_ldap.cc @@ -35,7 +35,7 @@ std::string parse_rgw_ldap_bindpw(CephContext* ctx) } } - return std::move(ldap_bindpw); + return ldap_bindpw; } #if defined(HAVE_OPENLDAP) diff --git a/src/rgw/rgw_token.h b/src/rgw/rgw_token.h index c357733e3f5..b13fe468634 100644 --- a/src/rgw/rgw_token.h +++ b/src/rgw/rgw_token.h @@ -144,7 +144,7 @@ namespace rgw { encode_json(f); std::ostringstream os; f->flush(os); - return std::move(to_base64(std::move(os.str()))); + return to_base64(std::move(os.str())); } friend inline ostream& operator<<(ostream& os, const RGWToken& token); -- 2.47.3