Kouhei Sutou
null+****@clear*****
Mon Nov 23 17:31:10 JST 2015
Kouhei Sutou 2015-11-23 17:31:10 +0900 (Mon, 23 Nov 2015) New Revision: cee888fab9a42df4f0d7bc79b2d631819a3dbe01 https://github.com/groonga/groonga/commit/cee888fab9a42df4f0d7bc79b2d631819a3dbe01 Message: Remove empty line from pretty print output Modified files: lib/output.c Modified: lib/output.c (+7 -9) =================================================================== --- lib/output.c 2015-11-23 17:21:13 +0900 (6c5fe59) +++ lib/output.c 2015-11-23 17:31:10 +0900 (2c99067) @@ -46,7 +46,13 @@ put_delimiter(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type) uint32_t level = CURR_LEVEL; switch (output_type) { case GRN_CONTENT_JSON: - if (level < 2) { return; } + if (level < 2) { + if (DEPTH > 0 && ctx->impl->output.is_pretty) { + GRN_TEXT_PUTC(ctx, outbuf, '\n'); + indent(ctx, outbuf, DEPTH); + } + return; + } if ((level & 3) == 3) { GRN_TEXT_PUTC(ctx, outbuf, ':'); if (ctx->impl->output.is_pretty) { @@ -90,10 +96,6 @@ grn_output_array_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_typ switch (output_type) { case GRN_CONTENT_JSON: GRN_TEXT_PUTC(ctx, outbuf, '['); - if (ctx->impl->output.is_pretty) { - GRN_TEXT_PUTC(ctx, outbuf, '\n'); - indent(ctx, outbuf, DEPTH + 1); - } break; case GRN_CONTENT_XML: GRN_TEXT_PUTC(ctx, outbuf, '<'); @@ -175,10 +177,6 @@ grn_output_map_open(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type, switch (output_type) { case GRN_CONTENT_JSON: GRN_TEXT_PUTS(ctx, outbuf, "{"); - if (ctx->impl->output.is_pretty) { - GRN_TEXT_PUTC(ctx, outbuf, '\n'); - indent(ctx, outbuf, DEPTH + 1); - } break; case GRN_CONTENT_XML: GRN_TEXT_PUTC(ctx, outbuf, '<'); -------------- next part -------------- HTML����������������������������...Download