Be C89 friendly, declare variables on the top of the functions

Fix broken build of commit 7488655ec55aec5de0ee89bf5f3853c62f20ce5e
Merge pull request #31 from linquize/c89

Be C89 friendly, declare variables on the top of the functions