From 3450062b30eb61acf2a1207e2af51d1db74eae27 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Thu, 13 Dec 2018 11:28:30 +0100 Subject: [PATCH] We can compare a std::string with a const char* using operator==, simplifies the code * rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp: --- rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp index df07b4ed8..d51e94813 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_node_info_and_types.cpp @@ -65,7 +65,7 @@ rmw_ret_t __get_guid_by_name( std::set 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); } } @@ -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 & 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(); });