Avoid function calls in a for loop test part

Change-Id: Ief0976e3d1cd1da7074b1ed6d427153ccc189f18
Merge "Avoid function calls in a for loop test part"