Issue 382: Move variables to top of function for non-C99 compilers.

This should address an issue compiling with older versions
of Visual Studio.