MAINT: const correctness and minor fixes to C code
Merge pull request #4801 from larsmans/c-fixes

MAINT: const correctness and minor fixes to C code