Kouhei Sutou
null+****@clear*****
Fri Jul 14 15:53:54 JST 2017
Kouhei Sutou 2017-07-14 15:53:54 +0900 (Fri, 14 Jul 2017) New Revision: 53978db2aff8e38b4f3b3ed66e51624e9d574c6a https://github.com/groonga/groonga/commit/53978db2aff8e38b4f3b3ed66e51624e9d574c6a Message: dump: simplify Modified files: lib/proc/proc_dump.c Modified: lib/proc/proc_dump.c (+4 -4) =================================================================== --- lib/proc/proc_dump.c 2017-07-14 15:52:44 +0900 (933f5ad) +++ lib/proc/proc_dump.c 2017-07-14 15:53:54 +0900 (93f3217) @@ -662,10 +662,8 @@ dump_records(grn_ctx *ctx, grn_dumper *dumper, grn_obj *table) GRN_TEXT_INIT(&delete_commands, 0); cursor = grn_table_cursor_open(ctx, table, NULL, 0, NULL, 0, 0, -1, GRN_CURSOR_BY_KEY); - for (i = 0; (id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL; - ++i, old_id = id) { - - if (i) { GRN_TEXT_PUTS(ctx, dumper->output, ",\n"); } + while ((id = grn_table_cursor_next(ctx, cursor)) != GRN_ID_NIL) { + if (old_id != GRN_ID_NIL) { GRN_TEXT_PUTS(ctx, dumper->output, ",\n"); } if (table->header.type == GRN_TABLE_NO_KEY && old_id + 1 < id) { grn_id current_id; for (current_id = old_id + 1; current_id < id; current_id++) { @@ -678,6 +676,8 @@ dump_records(grn_ctx *ctx, grn_dumper *dumper, grn_obj *table) } } dump_record(ctx, dumper, table, id, &columns, n_columns); + + old_id = id; } grn_table_cursor_close(ctx, cursor); GRN_TEXT_PUTS(ctx, dumper->output, "\n]\n"); -------------- next part -------------- HTML����������������������������...Download