Skip to content

Commit

Permalink
fixup! Small performance improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeautran committed Jan 2, 2018
1 parent 2349f98 commit 5a3afa7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/namespace_prefix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const std::vector<std::string> _ros_prefixes =
const std::string
_get_ros_prefix_if_exists(const std::string & topic_name)
{
for (auto const &prefix : _ros_prefixes) {
for (const auto & prefix : _ros_prefixes) {
if ((topic_name.rfind(prefix, 0) == 0) && (topic_name.at(prefix.length()) == '/')) {
return prefix;
}
Expand All @@ -44,7 +44,7 @@ _get_ros_prefix_if_exists(const std::string & topic_name)
const std::string
_strip_ros_prefix_if_exists(const std::string & topic_name)
{
for (auto const &prefix : _ros_prefixes) {
for (const auto & prefix : _ros_prefixes) {
if ((topic_name.rfind(prefix, 0) == 0) && (topic_name.at(prefix.length()) == '/')) {
return topic_name.substr(prefix.length());
}
Expand Down
4 changes: 2 additions & 2 deletions rmw_fastrtps_cpp/src/rmw_count.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ rmw_count_publishers(
WriterInfo * slave_target = impl->secondaryPubListener;
slave_target->mapmutex.lock();
*count = 0;
for (auto const &it : slave_target->topicNtypes) {
for (const auto & it : slave_target->topicNtypes) {
auto const topic_fqdn = _demangle_if_ros_topic(it.first);
if (topic_fqdn == topic_name) {
*count += it.second.size();
Expand Down Expand Up @@ -90,7 +90,7 @@ rmw_count_subscribers(
ReaderInfo * slave_target = impl->secondarySubListener;
*count = 0;
slave_target->mapmutex.lock();
for (auto const & it : slave_target->topicNtypes) {
for (const auto & it : slave_target->topicNtypes) {
auto const topic_fqdn = _demangle_if_ros_topic(it.first);
if (topic_fqdn == topic_name) {
*count += it.second.size();
Expand Down

0 comments on commit 5a3afa7

Please sign in to comment.