Yasuhiro Horimoto
null+****@clear*****
Tue Apr 24 15:52:02 JST 2018
Yasuhiro Horimoto 2018-04-24 15:52:02 +0900 (Tue, 24 Apr 2018) New Revision: 87ddc5536778380f3dc5ef7026511cce1efcab9c https://github.com/groonga/groonga/commit/87ddc5536778380f3dc5ef7026511cce1efcab9c Merged 63e0b56: ii: add log enhancements that output contents of a token (#840) Message: ii: modify to call "grn_ii_get_token_from_token_id" after "DEFINE_NAME" Because cause "variable definitions after expression". Modified files: lib/ii.c Modified: lib/ii.c (+22 -22) =================================================================== --- lib/ii.c 2018-04-24 15:45:27 +0900 (e5f1c3568) +++ lib/ii.c 2018-04-24 15:52:02 +0900 (de9beebf4) @@ -2743,10 +2743,10 @@ typedef struct { }\ }\ } else {\ + DEFINE_NAME(ii);\ grn_obj token;\ GRN_TEXT_INIT(&token, 0);\ grn_ii_get_token_from_token_id(ctx, ii, bt->tid, &token);\ - DEFINE_NAME(ii);\ CRIT(GRN_FILE_CORRUPT,\ "[ii][broken] invalid posting in chunk: <%.*s>: (%d,%d): <%.*s>",\ name_size, name, bt->tid, cid.rid,\ @@ -4590,10 +4590,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h if (!u->tf || !u->sid) { return grn_ii_delete_one(ctx, ii, tid, u, h); } if (u->sid > ii->header->smax) { ii->header->smax = u->sid; } if (!(a = array_get(ctx, ii, tid))) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to allocate an array: " "<%.*s>: " "<%u>:<%u>:<%u>" @@ -4605,10 +4605,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h return ctx->rc; } if (!(bs = encode_rec(ctx, ii, u, &size, 0))) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to encode a record: " "<%.*s>: " "<%u>:<%u>:<%u>" @@ -4624,10 +4624,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h if (!(a[0] & 1)) { pos = a[0]; if ((pseg = buffer_open(ctx, ii, pos, &bt, &b)) == GRN_II_PSEG_NOT_ASSIGNED) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to allocate a buffer: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4656,10 +4656,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h ii->header->total_chunk_size >> 10); buffer_split(ctx, ii, LSEG(pos), h); if (ctx->rc != GRN_SUCCESS) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); ERR(ctx->rc, "[ii][update][one] failed to split a buffer: " "<%.*s>: " @@ -4677,10 +4677,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h } buffer_flush(ctx, ii, LSEG(pos), h); if (ctx->rc != GRN_SUCCESS) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); ERR(ctx->rc, "[ii][update][one] failed to flush a buffer: " "<%.*s>: " @@ -4702,10 +4702,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h if ((pseg = buffer_open(ctx, ii, pos, &bt, &b)) == GRN_II_PSEG_NOT_ASSIGNED) { GRN_LOG(ctx, GRN_LOG_CRIT, "buffer not found a[0]=%d", a[0]); { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to reallocate a buffer: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4724,10 +4724,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h a[0], LSEG(a[0]), b, bfb, b->header.buffer_free, b->header.nterms, b->header.nterms_void); if (b->header.buffer_free < size) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] buffer is full: " "<%.*s>: " "<%u>:<%u><%u>: " @@ -4765,10 +4765,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h if (u2.rid != u->rid || u2.sid != u->sid) { uint8_t *bs2 = encode_rec(ctx, ii, &u2, &size2, 0); if (!bs2) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to encode a record2: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4783,10 +4783,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h if (pseg == GRN_II_PSEG_NOT_ASSIGNED) { GRN_FREE(bs2); { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to create a buffer2: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4810,10 +4810,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h GRN_FREE(bs2); buffer_close(ctx, ii, pseg); { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to put to buffer: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4848,10 +4848,10 @@ grn_ii_update_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h } pseg = buffer_new(ctx, ii, size, &pos, &bt, &br, &b, tid, h); if (pseg == GRN_II_PSEG_NOT_ASSIGNED) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][update][one] failed to create a buffer: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4948,10 +4948,10 @@ grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h goto exit; } if (!(bs = encode_rec(ctx, ii, u, &size, 1))) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][delete][one] failed to encode a record: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -4963,10 +4963,10 @@ grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h goto exit; } if ((pseg = buffer_open(ctx, ii, a[0], &bt, &b)) == GRN_II_PSEG_NOT_ASSIGNED) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][delete][one] failed to allocate a buffer: " "<%.*s>: " "<%u>:<%u><%u>: " @@ -4986,10 +4986,10 @@ grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h buffer_close(ctx, ii, pseg); buffer_flush(ctx, ii, LSEG(a[0]), h); if (ctx->rc != GRN_SUCCESS) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); ERR(ctx->rc, "[ii][delete][one] failed to flush a buffer: " "<%.*s>: " @@ -5009,10 +5009,10 @@ grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h continue; } if ((pseg = buffer_open(ctx, ii, a[0], &bt, &b)) == GRN_II_PSEG_NOT_ASSIGNED) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][delete][one] failed to reallocate a buffer: " "<%.*s>: " "<%u>:<%u><%u>: " @@ -5028,10 +5028,10 @@ grn_ii_delete_one(grn_ctx *ctx, grn_ii *ii, grn_id tid, grn_ii_updspec *u, grn_h GRN_LOG(ctx, GRN_LOG_DEBUG, "flushed! b=%p free=%d, seg(%d)", b, b->header.buffer_free, LSEG(a[0])); if (b->header.buffer_free < size) { + DEFINE_NAME(ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii, tid, &token); - DEFINE_NAME(ii); MERR("[ii][delete][one] buffer is full: " "<%.*s>: " "<%u>:<%u><%u>: " @@ -10448,10 +10448,10 @@ grn_ii_buffer_merge(grn_ctx *ctx, grn_ii_buffer *ii_buffer, a = array_get(ctx, ii_buffer->ii, tid); if (!a) { + DEFINE_NAME(ii_buffer->ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii_buffer->ii, tid, &token); - DEFINE_NAME(ii_buffer->ii); MERR("[ii][buffer][merge] failed to allocate an array: " "<%.*s>: " "<%u>: " @@ -10464,10 +10464,10 @@ grn_ii_buffer_merge(grn_ctx *ctx, grn_ii_buffer *ii_buffer, } term_buffer = get_term_buffer(ctx, ii_buffer); if (!term_buffer) { + DEFINE_NAME(ii_buffer->ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, ii_buffer->ii, tid, &token); - DEFINE_NAME(ii_buffer->ii); MERR("[ii][buffer][merge] failed to allocate a term buffer: " "<%.*s>: " "<%u>: " @@ -12784,10 +12784,10 @@ grn_ii_builder_pack_chunk(grn_ctx *ctx, grn_ii_builder *builder, } a = array_get(ctx, builder->ii, chunk->tid); if (!a) { + DEFINE_NAME(builder->ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, builder->ii, chunk->tid, &token); - DEFINE_NAME(builder->ii); MERR("[ii][builder][chunk][pack] failed to allocate an array: " "<%.*s>: " "<%u>:<%u>:<%u>: " @@ -12802,10 +12802,10 @@ grn_ii_builder_pack_chunk(grn_ctx *ctx, grn_ii_builder *builder, } else { a = array_get(ctx, builder->ii, chunk->tid); if (!a) { + DEFINE_NAME(builder->ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, builder->ii, chunk->tid, &token); - DEFINE_NAME(builder->ii); MERR("[ii][builder][chunk][pack] failed to allocate an array: " "<%.*s>: " "<%u>:<%u>: " @@ -13107,10 +13107,10 @@ grn_ii_builder_register_chunks(grn_ctx *ctx, grn_ii_builder *builder) a = array_get(ctx, builder->ii, builder->chunk.tid); if (!a) { + DEFINE_NAME(builder->ii); grn_obj token; GRN_TEXT_INIT(&token, 0); grn_ii_get_token_from_token_id(ctx, builder->ii, builder->chunk.tid, &token); - DEFINE_NAME(builder->ii); MERR("[ii][builder][chunk][register] " "failed to allocate an array in segment: " "<%.*s>: " -------------- next part -------------- HTML����������������������������... URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180424/58f4c51d/attachment-0001.htm