lloyd / yajl

A fast streaming JSON parsing library in C.
http://lloyd.github.com/yajl
ISC License
2.15k stars 435 forks source link

add ability for yajl handle to reset #177

Closed yanatan16 closed 8 years ago

yanatan16 commented 8 years ago

The main purpose of adding a reset ability is to use the same handle after an error or client cancellation without reallocation.

I haven't added tests yet, I was just going to add a new test executable under test/api.

Adds public api function:

void yajl_reset(yajl_handle handle)

Adds internal functions:

void yajl_bs_reset(yajl_bytestack obs);
void yajl_buf_reset(yajl_buf buf);
void yajl_lex_reset(yajl_lexer lxr);
ajdavis commented 8 years ago

Is the yajl_reset function here different from the one @lloyd wrote in https://github.com/lloyd/yajl/commit/646b8b82ce5441db3d11b98a1049e1fcb50fe776 for issue https://github.com/lloyd/yajl/issues/161?

yanatan16 commented 8 years ago

@ajdavis This looks basically the same as 646b8b8. I'll close this.