preliminary validator refactoring
In preparation for working on #622 (closed), I've done some cleanup in the validator code. It includes moving some duplicated code into separate functions, simplification of complex code blocks, conversion of some
if statements into
switch statements for readability, removal of some unused code and struct members, renaming of several functions in hopes that they'll be more consistent and intuitively understandable, and addition of comments. This can definitely still use more thought and improvement, but the mccabe complexities of the worst functions have been reduced from about 90 to about 40, and I want to move on to working on the DS-format trust anchors now; we can always refactor further later.
(This is marked as 'needs cleanup' because I want to squash down several of the commits before merge, but I'm leaving them as they are now to make it easier to review individual changes if needed.)