Fix windows build on older Visual Studio versions.

Write code in C89 compatible way (All variable declarations must be
first).