Use the correct types instead of void pointers in function signatures

This gets rid of 50 lines of code with just casts of void pointers,
making the code shorter and clearer.
Merge pull request #1645 from mstorsjo/type-signatures

Use the correct types instead of void pointers in function signatures