aboutsummaryrefslogtreecommitdiff
path: root/lua_cjson.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua_cjson.c')
-rw-r--r--lua_cjson.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index df3b71c..39e22ad 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -558,7 +558,7 @@ static int json_encode(lua_State *l)
558 558
559 /* Reset persistent encode_buf. Avoids temporary allocation 559 /* Reset persistent encode_buf. Avoids temporary allocation
560 * for a single call. */ 560 * for a single call. */
561 cfg->encode_buf.length = 0; 561 strbuf_reset(&cfg->encode_buf);
562 json_append_data(l, cfg, &cfg->encode_buf); 562 json_append_data(l, cfg, &cfg->encode_buf);
563 json = strbuf_string(&cfg->encode_buf, &len); 563 json = strbuf_string(&cfg->encode_buf, &len);
564 564
@@ -683,7 +683,7 @@ static void json_next_string_token(json_parse_t *json, json_token_t *token)
683 683
684 /* json->tmp is the temporary strbuf used to accumulate the 684 /* json->tmp is the temporary strbuf used to accumulate the
685 * decoded string value. */ 685 * decoded string value. */
686 json->tmp->length = 0; 686 strbuf_reset(json->tmp);
687 while ((ch = json->data[json->index]) != '"') { 687 while ((ch = json->data[json->index]) != '"') {
688 if (!ch) { 688 if (!ch) {
689 /* Premature end of the string */ 689 /* Premature end of the string */