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

use resize instead of pop_front in loop
pull/26216/head
Dean Lee 3 years ago committed by GitHub
parent 64f89beb0d
commit 0844662f84
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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