Prevent call strlen in loop condition