Skip to content

Commit

Permalink
Redundant .c_str() usage in rclcpp_components triggers ament_clang_ti…
Browse files Browse the repository at this point in the history
…dy warning (#2718)

* fix: Simplify string assignment for class name in node_main.cpp.in

Signed-off-by: LihanChen2004 <[email protected]>

* Remove redundant local variable `name`

Co-authored-by: Tomoya Fujita <[email protected]>
Signed-off-by: LihanChen2004 <[email protected]>

---------

Signed-off-by: LihanChen2004 <[email protected]>
Signed-off-by: LihanChen2004 <[email protected]>
Co-authored-by: Tomoya Fujita <[email protected]>
  • Loading branch information
LihanChen2004 and fujitatomoya authored Dec 29, 2024
1 parent 99f1d8d commit 1977397
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rclcpp_components/src/node_main.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ int main(int argc, char * argv[])
auto loader = new class_loader::ClassLoader(library_name);
auto classes = loader->getAvailableClasses<rclcpp_components::NodeFactory>();
for (const auto & clazz : classes) {
std::string name = clazz.c_str();
if (name.compare(class_name) == 0) {
if (clazz.compare(class_name) == 0) {
RCLCPP_DEBUG(logger, "Instantiate class %s", clazz.c_str());
std::shared_ptr<rclcpp_components::NodeFactory> node_factory = nullptr;
try {
Expand Down

0 comments on commit 1977397

Please sign in to comment.