Cabana: use deque::resize() instead of pop_back in loop (#26209)

use resize instead of pop_front in loop
old-commit-hash: 0844662f84
taco
Dean Lee 3 years ago committed by GitHub
parent ba08a4d2ac
commit 426eb2fc67
  1. 4
      tools/cabana/canmessages.cc

@ -71,8 +71,8 @@ void CANMessages::process(QHash<QString, std::deque<CanData>> *messages) {
msgs = std::move(new_msgs);
} else {
msgs.insert(msgs.begin(), std::make_move_iterator(new_msgs.begin()), std::make_move_iterator(new_msgs.end()));
while (msgs.size() >= settings.can_msg_log_size) {
msgs.pop_back();
if (msgs.size() > settings.can_msg_log_size) {
msgs.resize(settings.can_msg_log_size);
}
}
}

Loading…
Cancel
Save