diff options
Diffstat (limited to 'src/yajl.c')
-rw-r--r-- | src/yajl.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -68,7 +68,7 @@ yajl_alloc(const yajl_callbacks * callbacks, hand->callbacks = callbacks; hand->ctx = ctx; - hand->lexer = NULL; + hand->lexer = NULL; hand->bytesConsumed = 0; hand->decodeBuf = yajl_buf_alloc(&(hand->alloc)); hand->flags = 0; @@ -78,6 +78,26 @@ yajl_alloc(const yajl_callbacks * callbacks, return hand; } +void +yajl_reset(yajl_handle h) +{ + // reset the state stack to start + yajl_bs_flush(h->stateStack); + yajl_bs_push(h->stateStack, yajl_state_start); + + // reset bytesConsumed + h->bytesConsumed = 0; + + // clear decoding buf (note: not strictly neccesary, as + // this buffer is cleared on demand and reused) + yajl_buf_clear(h->decodeBuf); + + // reset lexer state + if (h->lexer != NULL) { + yajl_lex_reset(h->lexer); + } +} + int yajl_config(yajl_handle h, yajl_option opt, ...) { |