From 28fb2bde4373ea4edb8b558ae67e7792356757a3 Mon Sep 17 00:00:00 2001 From: Voldivh Date: Fri, 2 Sep 2022 09:48:21 -0500 Subject: [PATCH] Makes topic_name a const ref Signed-off-by: Voldivh (cherry picked from commit df27babd11d1a655d60ce9c5a4363f79ea8d6cf5) --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index fbe8ac6..9a5c62a 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -1498,23 +1498,23 @@ static dds_entity_t create_topic(dds_entity_t pp, struct ddsi_sertopic * sertopi return tp; } -void set_error_message_from_create_topic(dds_entity_t topic, std::string topic_name) +void set_error_message_from_create_topic(dds_entity_t topic, const std::string & topic_name) { assert(topic < 0); if (DDS_RETCODE_BAD_PARAMETER == topic) { - std::string error_msg = "failed to create topic [" + topic_name + + const std::string error_msg = "failed to create topic [" + topic_name + "] because the function was given invalid parameters"; RMW_SET_ERROR_MSG(error_msg.c_str()); } else if (DDS_RETCODE_INCONSISTENT_POLICY == topic) { - std::string error_msg = "failed to create topic [" + topic_name + + const std::string error_msg = "failed to create topic [" + topic_name + "] because it's already in use in this context with incompatible QoS settings"; RMW_SET_ERROR_MSG(error_msg.c_str()); } else if (DDS_RETCODE_PRECONDITION_NOT_MET == topic) { - std::string error_msg = "failed to create topic [" + topic_name + + const std::string error_msg = "failed to create topic [" + topic_name + "] because it's already in use in this context with a different message type"; RMW_SET_ERROR_MSG(error_msg.c_str()); } else { - std::string error_msg = "failed to create topic [" + topic_name + "] for unknown reasons"; + const std::string error_msg = "failed to create topic [" + topic_name + "] for unknown reasons"; RMW_SET_ERROR_MSG(error_msg.c_str()); } }