1
0
Fork 0

Reduce CPU hit in FGTaxiSegment::unblock

size() is O(N), empty() is constant time.
This commit is contained in:
James Turner 2018-09-02 19:56:26 +01:00
parent 95be7220a2
commit 35c5be004f

View file

@ -121,16 +121,14 @@ bool FGTaxiSegment::hasBlock(time_t now)
void FGTaxiSegment::unblock(time_t now)
{
if (blockTimes.size()) {
BlockListIterator i = blockTimes.begin();
if (i->getTimeStamp() < (now - 30)) {
blockTimes.erase(i);
}
if (blockTimes.empty())
return;
if (blockTimes.front().getTimeStamp() < (now - 30)) {
blockTimes.erase(blockTimes.begin());
}
}
/***************************************************************************
* FGTaxiRoute
**************************************************************************/