Skip to content

Commit

Permalink
Remember match attempts count for triggers that expand variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed May 15, 2011
1 parent c8fbcd6 commit c564879
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions evaluate.cpp
Expand Up @@ -349,11 +349,16 @@ int iCount = GetTriggerArray ().GetSize (); // how many there are


LONGLONG iOldTimeTaken = 0;
long iOldMatchAttempts = 0;


// remember time taken to execute them

if (trigger_item->regexp)
{
iOldTimeTaken = trigger_item->regexp->iTimeTaken;
iOldMatchAttempts = trigger_item->regexp->m_iMatchAttempts;
}

delete trigger_item->regexp; // get rid of earlier regular expression
trigger_item->regexp = NULL;
Expand Down Expand Up @@ -384,7 +389,10 @@ int iCount = GetTriggerArray ().GetSize (); // how many there are

// add back execution time
if (trigger_item->regexp)
{
trigger_item->regexp->iTimeTaken += iOldTimeTaken;
trigger_item->regexp->m_iMatchAttempts += iOldMatchAttempts;
}

} // end of variable substitution

Expand Down

0 comments on commit c564879

Please sign in to comment.