From 288ee96cc793c0dc976f7141efc154f917419ad4 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Sat, 14 Oct 2017 18:57:27 +0300 Subject: [PATCH] Avoid recomputing loop range end --- lib/checksizeof.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/checksizeof.cpp b/lib/checksizeof.cpp index aa22c3872..8b3b29e5f 100644 --- a/lib/checksizeof.cpp +++ b/lib/checksizeof.cpp @@ -159,7 +159,8 @@ void CheckSizeof::checkSizeofForPointerSize() tokSize = tokSize->nextArgument(); if (tokFunc && tokSize) { - for (const Token* tok2 = tokSize; tok2 != tokFunc->linkAt(1); tok2 = tok2->next()) { + const Token * const paramsListEndTok = tokFunc->linkAt(1); + for (const Token* tok2 = tokSize; tok2 != paramsListEndTok; tok2 = tok2->next()) { if (Token::simpleMatch(tok2, "/ sizeof")) { // Allow division with sizeof(char) if (Token::simpleMatch(tok2->next(), "sizeof (")) {