Skip to content

Commit efc96a2

Browse files
committed
common/Finisher: pass name as std::string_view to ctor
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 <[email protected]>
1 parent f4bc4be commit efc96a2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/common/Finisher.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Finisher::Finisher(CephContext *cct_) :
1515
thread_name("fn_anonymous"),
1616
finisher_thread(this) {}
1717

18-
Finisher::Finisher(CephContext *cct_, std::string name, std::string tn) :
18+
Finisher::Finisher(CephContext *cct_, std::string_view name, std::string &&tn) :
1919
cct(cct_), finisher_lock(ceph::make_mutex(fmt::format("Finisher::{}", name))),
20-
thread_name(tn),
20+
thread_name(std::move(tn)),
2121
finisher_thread(this) {
2222
PerfCountersBuilder b(cct, fmt::format("finisher-{}", name),
2323
l_finisher_first, l_finisher_last);

src/common/Finisher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Finisher {
122122
explicit Finisher(CephContext *cct_);
123123

124124
/// Construct a named Finisher that logs its queue length.
125-
Finisher(CephContext *cct_, std::string name, std::string tn);
125+
Finisher(CephContext *cct_, std::string_view name, std::string &&tn);
126126
~Finisher();
127127
};
128128

0 commit comments

Comments
 (0)