GMP cleanup/fixes

- Fixes a memory leak in gmp_init
- Removes uses of mpz_clears/mpz_inits, which some GMP versions do not have (should fix #3421)
- C++ functions that should be static are now static
- Re-adds miss-merged lint fixes