]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: removing an unneeded make_unique()
authorRonen Friedman <rfriedma@redhat.com>
Thu, 16 Dec 2021 10:49:57 +0000 (10:49 +0000)
committerRonen Friedman <rfriedma@redhat.com>
Thu, 16 Dec 2021 10:49:57 +0000 (10:49 +0000)
As the desired lifetime of the object matches the lifetime if
it is allocated on the stack, and as no ownership is transferred,
there is no point in using a unique_ptr here.

And see Google's guidance (https://abseil.io/tips/187),
under "Common Anti-Pattern: Avoiding &".

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/crimson/osd/main.cc

index 8526885bbfb1591bb2a02c62281e75c3fa7e9612..23ec839ca4680f37520b47c2046d705e6fab6ba6 100644 (file)
@@ -106,7 +106,8 @@ seastar::future<> make_keyring()
       fmt::print(std::cerr, "already have key in keyring: {}\n", path);
       return seastar::now();
     } else {
-      auth.key.create(std::make_unique<CephContext>().get(), CEPH_CRYPTO_AES);
+      CephContext temp_cct{};
+      auth.key.create(&temp_cct, CEPH_CRYPTO_AES);
       keyring.add(name, auth);
       bufferlist bl;
       keyring.encode_plaintext(bl);