Skip to content

Commit

Permalink
refactor: limit scope of local variable and declare const
Browse files Browse the repository at this point in the history
  • Loading branch information
rokusottervanger committed Apr 8, 2022
1 parent 1d73654 commit f1b65d6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions diagnostic_aggregator/src/aggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ void Aggregator::publishData()
diag_toplevel_state.level = -1;
int min_level = 255;
uint non_ok_status_depth = 0;
uint depth = 0;
uint report_idx = 0;

vector<boost::shared_ptr<diagnostic_msgs::DiagnosticStatus> > processed;
Expand All @@ -240,7 +239,7 @@ void Aggregator::publishData()
{
diag_array.status.push_back(*processed[i]);

depth = static_cast<uint>(std::count(processed[i]->name.begin(), processed[i]->name.end(), '/'));
const uint depth = static_cast<uint>(std::count(processed[i]->name.begin(), processed[i]->name.end(), '/'));
if (processed[i]->level > diag_toplevel_state.level)
{
diag_toplevel_state.level = processed[i]->level;
Expand Down Expand Up @@ -279,7 +278,7 @@ void Aggregator::publishData()
{
diag_array.status.push_back(*processed_other[i]);

depth = static_cast<uint>(std::count(processed[i]->name.begin(), processed[i]->name.end(), '/'));
const uint depth = static_cast<uint>(std::count(processed[i]->name.begin(), processed[i]->name.end(), '/'));
if (processed_other[i]->level > diag_toplevel_state.level)
{
diag_toplevel_state.level = processed_other[i]->level;
Expand Down

0 comments on commit f1b65d6

Please sign in to comment.