Skip to content

Commit cebf6e3

Browse files
committed
Optimized MockExpectedCallsList::isEmpty().
This simple modification changes the order of this function to O(1) instead of O(n). Taking in account that this function is called at least once each time that an actual call is created, or withParameter()/onObject() is called on it, the overall actual calls processing can be reduced from O(n!) to O(n)!
1 parent f6d698e commit cebf6e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/CppUTestExt/MockExpectedCallsList.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ unsigned int MockExpectedCallsList::size() const
6060

6161
bool MockExpectedCallsList::isEmpty() const
6262
{
63-
return size() == 0;
63+
return head_ == NULL;
6464
}
6565

6666

0 commit comments

Comments
 (0)