Add missing NUL terminator.
Add missing braces.
buffer_putvfstring should return number of chars written.
Use cleaner variable names and add asserts.
Mirror code for growing buffer.
Various bugfixes to buffer library.

* buffer-bugfix:
  Mirror code for growing buffer.
  Use cleaner variable names and add asserts.
  buffer_putvfstring should return number of chars written.
  Add missing braces.
  Add missing NUL terminator.