aboutsummaryrefslogtreecommitdiff
path: root/lua_cjson.c
diff options
context:
space:
mode:
Diffstat (limited to 'lua_cjson.c')
-rw-r--r--lua_cjson.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lua_cjson.c b/lua_cjson.c
index fa2d6a7..63b3d06 100644
--- a/lua_cjson.c
+++ b/lua_cjson.c
@@ -500,12 +500,12 @@ static void json_append_array(lua_State *l, json_config_t *cfg, strbuf_t *json,
500 500
501 json_encode_descend(l, cfg); 501 json_encode_descend(l, cfg);
502 502
503 strbuf_append_mem(json, "[ ", 2); 503 strbuf_append_char(json, '[');
504 504
505 comma = 0; 505 comma = 0;
506 for (i = 1; i <= array_length; i++) { 506 for (i = 1; i <= array_length; i++) {
507 if (comma) 507 if (comma)
508 strbuf_append_mem(json, ", ", 2); 508 strbuf_append_char(json, ',');
509 else 509 else
510 comma = 1; 510 comma = 1;
511 511
@@ -514,7 +514,7 @@ static void json_append_array(lua_State *l, json_config_t *cfg, strbuf_t *json,
514 lua_pop(l, 1); 514 lua_pop(l, 1);
515 } 515 }
516 516
517 strbuf_append_mem(json, " ]", 2); 517 strbuf_append_char(json, ']');
518 518
519 cfg->current_depth--; 519 cfg->current_depth--;
520} 520}
@@ -538,14 +538,14 @@ static void json_append_object(lua_State *l, json_config_t *cfg,
538 json_encode_descend(l, cfg); 538 json_encode_descend(l, cfg);
539 539
540 /* Object */ 540 /* Object */
541 strbuf_append_mem(json, "{ ", 2); 541 strbuf_append_char(json, '{');
542 542
543 lua_pushnil(l); 543 lua_pushnil(l);
544 /* table, startkey */ 544 /* table, startkey */
545 comma = 0; 545 comma = 0;
546 while (lua_next(l, -2) != 0) { 546 while (lua_next(l, -2) != 0) {
547 if (comma) 547 if (comma)
548 strbuf_append_mem(json, ", ", 2); 548 strbuf_append_char(json, ',');
549 else 549 else
550 comma = 1; 550 comma = 1;
551 551
@@ -554,10 +554,10 @@ static void json_append_object(lua_State *l, json_config_t *cfg,
554 if (keytype == LUA_TNUMBER) { 554 if (keytype == LUA_TNUMBER) {
555 strbuf_append_char(json, '"'); 555 strbuf_append_char(json, '"');
556 json_append_number(l, json, -2, cfg->encode_refuse_badnum); 556 json_append_number(l, json, -2, cfg->encode_refuse_badnum);
557 strbuf_append_mem(json, "\": ", 3); 557 strbuf_append_mem(json, "\":", 2);
558 } else if (keytype == LUA_TSTRING) { 558 } else if (keytype == LUA_TSTRING) {
559 json_append_string(l, json, -2); 559 json_append_string(l, json, -2);
560 strbuf_append_mem(json, ": ", 2); 560 strbuf_append_char(json, ':');
561 } else { 561 } else {
562 json_encode_exception(l, -2, 562 json_encode_exception(l, -2,
563 "table key must be a number or string"); 563 "table key must be a number or string");
@@ -570,7 +570,7 @@ static void json_append_object(lua_State *l, json_config_t *cfg,
570 /* table, key */ 570 /* table, key */
571 } 571 }
572 572
573 strbuf_append_mem(json, " }", 2); 573 strbuf_append_char(json, '}');
574 574
575 cfg->current_depth--; 575 cfg->current_depth--;
576} 576}