Fix null termination in stringbuilder and refactor

Fix an issue in stringbuilder whereby it was not null terminating
strings correctly.  In applying this fix, a number of vaguely related
changes are made.

stringbuilder
 - Fill string buffer with null on creation and resize to ensure any
   characters not written to the string are null, and the buffer is
   therefore always null terminated.
 - Make sb_reset a function, not a macro
 - Add sb_resize function as reusuable and consistent means of resizing
   buffer
 - Add sb_double_size as a convenience function to double the buffer size
 - Make sb_append_ch a function, not a macro
 - Change resize strategy in sb_append_strn to keep doubling the new
   buffer size until the string to be appended will fit

stringbuilder_test
 - Add check of cstring's length to _assert_sb_stats
 - Modify tests to match new code
Merge pull request #2 from ajmccluskey/null-terminators

Fix null termination in stringbuilder and refactor