Skip to content

Commit

Permalink
Set string arguments as const references (eProsima#5179)
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <jesuspoderoso@eprosima.com>
Signed-off-by: paxifaer <807128216@qq.com>
  • Loading branch information
JesusPoderoso authored and paxifaer committed Sep 7, 2024
1 parent 7a19061 commit 30328eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ bool DiscoveryDataBase::update(

bool DiscoveryDataBase::update(
eprosima::fastdds::rtps::CacheChange_t* change,
std::string topic_name)
const std::string& topic_name)
{
// in case the ddb is persistent, we store every cache in queue in a file
if (is_persistent_ && guid_from_change(change).guidPrefix != server_guid_prefix_)
Expand Down Expand Up @@ -1252,7 +1252,7 @@ void DiscoveryDataBase::match_writer_reader_(
}

bool DiscoveryDataBase::set_dirty_topic_(
std::string topic)
const std::string& topic)
{
EPROSIMA_LOG_INFO(DISCOVERY_DATABASE, "Setting topic " << topic << " as dirty");

Expand Down Expand Up @@ -2647,7 +2647,7 @@ void DiscoveryDataBase::clean_backup()
}

void DiscoveryDataBase::persistence_enable(
std::string backup_file_name)
const std::string& backup_file_name)
{
is_persistent_ = true;
backup_file_name_ = backup_file_name;
Expand Down
6 changes: 3 additions & 3 deletions src/cpp/rtps/builtin/discovery/database/DiscoveryDataBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class DiscoveryDataBase
*/
bool update(
eprosima::fastdds::rtps::CacheChange_t* change,
std::string topic_name);
const std::string& topic_name);

bool update(
eprosima::fastdds::rtps::CacheChange_t* change,
Expand All @@ -144,7 +144,7 @@ class DiscoveryDataBase

// enable ddb in persistence mode and open the file to backup up in append mode
void persistence_enable(
std::string backup_file_name);
const std::string& backup_file_name);

//! Disable the possibility to add new entries to the database
void disable()
Expand Down Expand Up @@ -498,7 +498,7 @@ class DiscoveryDataBase
//! Add a topic to the list of dirty topics, unless it's already present
// Return true if added, false if already there
bool set_dirty_topic_(
std::string topic);
const std::string& topic);

// Add data in pdp_to_send if not already in it
bool add_pdp_to_send_(
Expand Down

0 comments on commit 30328eb

Please sign in to comment.