Skip to content

Commit

Permalink
chore: remove the redundant std::string creation
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanYuYuan committed Dec 16, 2024
1 parent 443a373 commit cba4490
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ bool SubscriptionData::init()
zenoh::Subscriber<void> sub = context_impl->session()->declare_subscriber(
sub_ke,
[data_wp](const zenoh::Sample & sample) {
zenoh::KeyExpr keystr(std::string(sample.get_keyexpr().as_string_view()));

auto sub_data = data_wp.lock();
if (sub_data == nullptr) {
Expand All @@ -313,7 +312,7 @@ bool SubscriptionData::init()
payload.as_vector(),
std::chrono::system_clock::now().time_since_epoch().count(),
std::move(attachment_data)),
std::string(keystr.as_string_view()));
std::string(sample.get_keyexpr().as_string_view()));
},
zenoh::closures::none,
std::move(sub_options),
Expand Down

0 comments on commit cba4490

Please sign in to comment.