Fix breakage of DSO loading on all platforms

bc00a9937 fixed a spelling error, but failed to fix the accidentally
inverted logic, meaning that instead of underscores being
unconditionally omitted, they would instead be added when they are
not needed, and omitted when they are needed.

Exit statuses are hard. Used EXIT_SUCCESS/EXIT_FAILURE in the hopes of
making the code readable.
Fix EZC usage of ThreadLocal and clarify ThreadLocal comments

I inappropriately had EZC's TSRM layer create ThreadLocal objects as
true globals, instead of using DECLARE_THREAD_LOCAL and
IMPLEMENT_THREAD_LOCAL. Fixed this, and clarified and expanded the
comments in thread-local.h to address the origin of the error.

Also:

* Fixed some whitespace and namespacing issues in this code, along
  the lines of my previous EZC commits.
* Fixed a bounds check in ts_free_id().