Rewriting entry_is_time_to_retry() using table approach.
Write comments for members of periods array.
Unit testing entry_is_time_to_retry().
Small cleanups to test_entry_is_time_to_retry
Whitespace fixes
Merge branch 'bug12205_take2_squashed'
Make the two branches of tor_tls_used_v1_handshake into one.

(Coverity thinks that "if (a) X; else X;" is probably a bug.)

[Coverity CID 1232086]
Fix memory leaks in test_entrynodes.c

[Coverity CID 1232087 and 1232088]
Explicitly cast when dividing ints then implicitly casting to double.

Coverity thinks that when we do "double x = int1/int2;", we probably
meant "double x = ((double)int1) / int2;".  In these cases, we
didn't.

[Coverity CID 1232089 and 1232090]
Add a missing goto to an unusable branch and make the branch LD_BUG.

(It's LD_BUG to reach this point because the hashed password values
were tested earlier from options_validate)

[Coverity CID 1232091]
Remove a dead check for errmsg in handle_control_authenticate

Coverity doesn't like doing NULL checks on things that can't be
NULL; I like checking things where the logic for their not being
NULL is nontrivial.  Let's compromise, and make it obvious that this
field can't be NULL.

[Coverity CID 202004]
Allow rend_service_intro_free to get called with NULL

(We allowed it previously, but produced an LD_BUG message when it
happened, which is not consistent

Also, remove inconsistent NULL checks before calling
rend_service_intro_free.

(Removing the check is for CID 718613)
Check return values for fcntl in tor_spawn_background.

[CID 718609]
Suppress coverity warning about overflowing in tor_memeq.

The unsigned underflow here is defined and intentional.

CID 202482
Avoid performing an assert on an always-true value

This was freaking out coverity.

[CID 743379]
Suppress coverity warning about overflowing in safe_mem_is_zero

The unsigned underflow here is defined and intentional.

CID 202482
remove meaningless checks for chunks==NULL in dirserv stuff

Also, make it clearer that chunks cannot be NULL

[CID 1031750, 1031751]
Mark one use of networkstatus_check_document_signature as (void)

Also explain why we aren't checking its return value.

[CID 1198197]
Check for duplicate arguments to tor-gencert

Found by coverity, which noticed that if you said
  tor-gencert -i identity1 -i identity2
we would leak "identity1".

[CID 1198201, 1198202, 1198203]
Store sandbox params as char *, since that's what they are.

This allows coverity to infer that we aren't leaking them.

[Fixes a lot of CIDs]