Convert checkpoint.c to C++ compilation

- Remove unused variables.
- Some minor include cleanup.
- Fix some variable types and return value propagation.

The main motivation is that this file is the single caller for
Program(), which has a C++ replacement.  Using that (not done here)
would allow removing the old C function.

Change-Id: I58567ff177d2a2c193f9a926e484c6ff30601661