Fix C FFI to use *mut pointers correctly and update code.

This was found because of unused mut warnings.
Merge pull request #9 from metajack/unused-mut

Fix C FFI to use *mut pointers correctly and update code.