]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
common/Finisher: pass name as std::string_view to ctor
authorMax Kellermann <max.kellermann@ionos.com>
Wed, 9 Oct 2024 12:29:38 +0000 (14:29 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Thu, 10 Oct 2024 06:55:31 +0000 (08:55 +0200)
This eliminates a temporary `std::string`.

Additionally, convert the `tn` parameter to an rvalue reference and
move it to `thread_name`.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/common/Finisher.cc
src/common/Finisher.h

index c6d3746d8c0540bc9c8229f6df54b7a9ea278a41..43550f351973e2baa665ba0f0570c3de2d9949a7 100644 (file)
@@ -15,9 +15,9 @@ Finisher::Finisher(CephContext *cct_) :
   thread_name("fn_anonymous"),
   finisher_thread(this) {}
 
-Finisher::Finisher(CephContext *cct_, std::string name, std::string tn) :
+Finisher::Finisher(CephContext *cct_, std::string_view name, std::string &&tn) :
   cct(cct_), finisher_lock(ceph::make_mutex(fmt::format("Finisher::{}", name))),
-  thread_name(tn),
+  thread_name(std::move(tn)),
   finisher_thread(this) {
   PerfCountersBuilder b(cct, fmt::format("finisher-{}", name),
                        l_finisher_first, l_finisher_last);
index 1a89f4289b71573475b086b756ed1381e222d8a5..acee6594ca4da327fe6cf19d8137581083682eaf 100644 (file)
@@ -122,7 +122,7 @@ class Finisher {
   explicit Finisher(CephContext *cct_);
 
   /// Construct a named Finisher that logs its queue length.
-  Finisher(CephContext *cct_, std::string name, std::string tn);
+  Finisher(CephContext *cct_, std::string_view name, std::string &&tn);
   ~Finisher();
 };