Reduce [*]printf()s and escaping to temporary buffers.

Add functions to snprintf() and ndo_escape_buffer() directly to a
ndo_dbuf, eliminating the need for intermediary temp buffers and
repeated code. Also add a function to reset a ndo_dbuf without freeing
its internal buffer to avoid extra memory management in string building
sequences.

Start refactoring ndomod's data serialization to make use of these new
functions.