Avoid function calls in the loop condition of a for statement

Change-Id: I64d9ba96797085b6f54658218404a02d4087ceaf
Merge "Avoid function calls in the loop condition of a for statement"