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

Use empty() to check for an empty string #247

Merged
merged 1 commit into from
Dec 21, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion rmw_fastrtps_shared_cpp/src/demangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ std::string
_demangle_service_from_topic(const std::string & topic_name)
{
std::string prefix = _get_ros_prefix_if_exists(topic_name);
if (!prefix.length()) {
if (prefix.empty()) {
// not a ROS topic or service
return "";
}
Expand Down
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 @@ -416,13 +416,13 @@ __rmw_get_service_names_and_types_by_node(
if (node_topics != topic_cache.getParticipantToTopics().end()) {
for (auto & topic_pair : node_topics->second) {
std::string service_name = _demangle_service_from_topic(topic_pair.first);
if (!service_name.length()) {
if (service_name.empty()) {
// not a service
continue;
}
for (auto & itt : topic_pair.second) {
std::string service_type = _demangle_service_type_only(itt);
if (service_type.length()) {
if (!service_type.empty()) {
services[service_name].insert(service_type);
}
}
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_shared_cpp/src/rmw_service_names_and_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ __rmw_get_service_names_and_types(
std::lock_guard<std::mutex> guard(topic_cache.getMutex());
for (auto it : topic_cache.getTopicToTypes()) {
std::string service_name = _demangle_service_from_topic(it.first);
if (!service_name.length()) {
if (service_name.empty()) {
// not a service
continue;
}
for (auto & itt : it.second) {
std::string service_type = _demangle_service_type_only(itt);
if (service_type.length()) {
if (!service_type.empty()) {
services[service_name].insert(service_type);
}
}
Expand Down