]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Remove pessimizing move of return values
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 10 Apr 2017 17:12:08 +0000 (13:12 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Tue, 11 Apr 2017 01:57:14 +0000 (21:57 -0400)
C++ performs copy elision of return values if:

1. The value is a local declared in the function (i.e. not a
   parameter)
2. The type of the value in the return statement is, modulo
   const-value qualification, identical to the return type of the
   function.

An RValue reference to a type is not identical, modulo const-value
qualification, to the type it is a reference to.

Do not std::move local values in the return statement unless the value
is a parameter or you will make the compiler perform a copy it would
iotherwise avoid.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_auth_s3.cc

index f4b34e929e854e169cdd975ca32967c365ee512b..ed61d024a9e0dac0df11e53f67e3fcd85778bfd1 100644 (file)
@@ -57,7 +57,7 @@ get_canon_amz_hdr(const std::map<std::string, std::string>& meta_map)
     dest.append("\n");
   }
 
-  return std::move(dest);
+  return dest;
 }
 
 /*
@@ -95,7 +95,7 @@ get_canon_resource(const char* const request_uri,
   }
 
   dout(10) << "get_canon_resource(): dest=" << dest << dendl;
-  return std::move(dest);
+  return dest;
 }
 
 /*