From: Ronen Friedman Date: Thu, 16 Dec 2021 10:49:57 +0000 (+0000) Subject: crimson/osd: removing an unneeded make_unique() X-Git-Tag: v17.1.0~222^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F44331%2Fhead;p=ceph.git crimson/osd: removing an unneeded make_unique() 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 --- diff --git a/src/crimson/osd/main.cc b/src/crimson/osd/main.cc index 8526885bbfb1..23ec839ca468 100644 --- a/src/crimson/osd/main.cc +++ b/src/crimson/osd/main.cc @@ -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().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);