Increase config snapshot usage

I started out cleaning up a few of things that Coverity pointed out after the recent merges, then got distracted because I had a breakpoint in `giterr_set` and it was getting called a lot more than it used to. This was because the new config snapshotting code tries to reload the config a lot more and so the functions that search for the global and system config files are getting triggered a lot more (and those generate "not found" errors).

It seemed like the best way to deal with this was just to increase the use of snapshots where possible.

So this PR contains some cleanups, with a focus on moving more config stuff over to use snapshots. To facilitate this, I added an API to the repository CVAR cache stuff so that it could be invoked on a snapshot. This will actually improve diff, I think, because we will load most of the diff config from a single snapshot of the values.