From 454dd0a7360f1dcebe0ce26e6f8d9853d44519f6 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Tue, 1 Jul 2014 17:16:45 +0400 Subject: [PATCH] Break the loop once the result can no longer change. --- lib/checkassert.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/checkassert.cpp b/lib/checkassert.cpp index b5bfc7255..25d4a94bf 100644 --- a/lib/checkassert.cpp +++ b/lib/checkassert.cpp @@ -81,7 +81,10 @@ void CheckAssert::assertWithSideEffects() bool noReturnInScope = true; for (std::vector::iterator rt = returnTokens.begin(); rt != returnTokens.end(); ++rt) { - noReturnInScope &= !inSameScope(*rt, tok2); + if (!inSameScope(*rt, tok2)) { + noReturnInScope = false; + break; + } } if (noReturnInScope) continue; bool isAssigned = checkVariableAssignment(tok2, false);