Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We can compare a std::string with a const char* using operator==, sim… #248

Merged
merged 1 commit into from
Dec 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ rmw_ret_t __get_guid_by_name(
std::set<GUID_t> nodes_in_desired_namespace;
auto namespaces = impl->listener->discovered_namespaces;
for (auto & guid_to_namespace : impl->listener->discovered_namespaces) {
if (strcmp(guid_to_namespace.second.c_str(), node_namespace) == 0) {
if (guid_to_namespace.second == node_namespace) {
nodes_in_desired_namespace.insert(guid_to_namespace.first);
}
}
Expand All @@ -74,7 +74,7 @@ rmw_ret_t __get_guid_by_name(
impl->listener->discovered_names.end(),
[node_name, &nodes_in_desired_namespace](const std::pair<const GUID_t,
std::string> & pair) {
return strcmp(pair.second.c_str(), node_name) == 0 &&
return pair.second == node_name &&
nodes_in_desired_namespace.find(pair.first) != nodes_in_desired_namespace.end();
});

Expand Down