Kouhei Sutou
null+****@clear*****
Wed Nov 21 18:42:36 JST 2012
Kouhei Sutou 2012-11-21 18:42:36 +0900 (Wed, 21 Nov 2012) New Revision: 0d5d57c3aea21fec7315c5e7f87e74306f0592bf https://github.com/groonga/groonga/commit/0d5d57c3aea21fec7315c5e7f87e74306f0592bf Log: Use separated array for command error location CAUTION: This change is backward incompatible change but it will not break any existing program. Because it is not documented (Sorry. I'm writing the document.) and it is rare case. No program that parses output of the case will exist. Think about the following command in /tmp/error.grn: nonexistent_command argument It is uses with the following command line: % groonga --file /tmp/error.grn -n /tmp/db The output is changed by this change. Here are the outputs with/without this change. (They are pretty-formatted by hand for readability.) before: [ [ -22, 1353490445.90846, 0.000262260437011719, "invalid command name: nonexistent_command", [ [ "grn_ctx_qe_exec", "ctx.c", 1394 "/tmp/error.grn", # DIFFERENT 1, # DIFFERENT "nonexistent_command argument" # DIFFERENT ], ] ] ] after: [ [ -22, 1353490445.90846, 0.000262260437011719, "invalid command name: nonexistent_command", [ [ "grn_ctx_qe_exec", "ctx.c", 1394 ], # DIFFERENT [ # DIFFERENT "/tmp/error.grn", # DIFFERENT 1, # DIFFERENT "nonexistent_command argument" # DIFFERENT ] ] ] ] Modified files: lib/output.c Modified: lib/output.c (+4 -2) =================================================================== --- lib/output.c 2012-11-21 17:59:13 +0900 (04ac474) +++ lib/output.c 2012-11-21 18:42:36 +0900 (d6f48e3) @@ -1644,15 +1644,17 @@ grn_output_envelope(grn_ctx *ctx, grn_text_esc(ctx, head, ctx->errfile, strlen(ctx->errfile)); GRN_TEXT_PUTC(ctx, head, ','); grn_text_itoa(ctx, head, ctx->errline); + GRN_TEXT_PUTS(ctx, head, "]"); if (file && (command = GRN_CTX_USER_DATA(ctx)->ptr)) { - GRN_TEXT_PUTC(ctx, head, ','); + GRN_TEXT_PUTS(ctx, head, ",["); grn_text_esc(ctx, head, file, strlen(file)); GRN_TEXT_PUTC(ctx, head, ','); grn_text_itoa(ctx, head, line); GRN_TEXT_PUTC(ctx, head, ','); grn_text_esc(ctx, head, GRN_TEXT_VALUE(command), GRN_TEXT_LEN(command)); + GRN_TEXT_PUTS(ctx, head, "]"); } - GRN_TEXT_PUTS(ctx, head, "]]"); + GRN_TEXT_PUTS(ctx, head, "]"); } } GRN_TEXT_PUTC(ctx, head, ']'); -------------- next part -------------- HTML����������������������������... Download