Skip to content

Commit

Permalink
Use of a potentially moved-from object #sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
serges147 committed May 8, 2024
1 parent d935e95 commit e18ebd8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/libcyphal/transport/can/delegate.hpp
Original file line number Diff line number Diff line change
@@ -135,7 +135,7 @@ class TransportDelegate
/// @return Total count of visited nodes (including the `node` one). `0` if `node` is `nullptr`.
///
template <typename Visitor>
static std::size_t visitCounting(CanardTreeNode* const node, Visitor&& visitor) // NOLINT(misc-no-recursion)
static std::size_t visitCounting(CanardTreeNode* const node, const Visitor& visitor) // NOLINT(misc-no-recursion)
{
if (node == nullptr)
{
@@ -145,11 +145,11 @@ class TransportDelegate
// Initial `1` is for the current node.
std::size_t count = 1;

count += visitCounting(node->lr[0], std::forward<Visitor>(visitor));
// Next nolint & nosonar are unavoidable: this is integration with low-level C code of Canard AVL trees.
count += visitCounting(node->lr[0], visitor);
// Next nolint & NOSONAR are unavoidable: this is integration with low-level C code of Canard AVL trees.
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
visitor(*reinterpret_cast<Node*>(node)); // NOSONAR
count += visitCounting(node->lr[1], std::forward<Visitor>(visitor));
count += visitCounting(node->lr[1], visitor);

return count;
}

0 comments on commit e18ebd8

Please sign in to comment.