lloyd/yajl — pull request #76 by rotty (2012-03-22 12:12:17+00:00)
Title: encode: add function to completely reset generator state

AFAICS, with the current codebase, a new generator instance has to be created for each JSON value.
I'm implementing a protocol based on the exchange of JSON objects. For this use-case it is convenient and also more efficient to re-use the existing generator instance for the entire communication instead of re-allocating a new generator instance for each object/message. I hence implemented a new function to reset the generator state, tentatively named yajl_gen_reset().

From the source code comment added for that function:

/** completely reset the generator state. Using this function
* allows for a single generator instance to be used to generate a
* series of JSON values. This the counterpart to the
* yajl_allow_multiple_values parser option. */