susumu.yata
null+****@clear*****
Wed Sep 9 14:06:23 JST 2015
susumu.yata 2015-09-09 14:06:23 +0900 (Wed, 09 Sep 2015) New Revision: 6a0a6bb3f3483fd799249afa29047033c8f2035e https://github.com/groonga/groonga/commit/6a0a6bb3f3483fd799249afa29047033c8f2035e Message: grn_ts: use grn_ts_expr_node_evaluate_to_buf() GitHub: #385 Modified files: lib/ts.c Modified: lib/ts.c (+8 -16) =================================================================== --- lib/ts.c 2015-09-09 14:01:23 +0900 (a5d361d) +++ lib/ts.c 2015-09-09 14:06:23 +0900 (a3d8505) @@ -2022,21 +2022,17 @@ grn_ts_op_logical_and_evaluate(grn_ctx *ctx, grn_ts_expr_op_node *node, const grn_ts_record *in, size_t n_in, void *out) { size_t i; - grn_ts_bool *out_ptr = (grn_ts_bool *)out; - grn_ts_bool *buf_ptr; + grn_ts_buf *buf = &node->bufs[0]; + grn_ts_bool *buf_ptr, *out_ptr = (grn_ts_bool *)out; grn_rc rc = grn_ts_expr_node_evaluate(ctx, node->args[0], in, n_in, out); if (rc != GRN_SUCCESS) { return rc; } - rc = grn_ts_buf_reserve(ctx, &node->bufs[0], sizeof(grn_ts_bool) * n_in); - if (rc != GRN_SUCCESS) { - return rc; - } - buf_ptr = (grn_ts_bool *)node->bufs[0].ptr; - rc = grn_ts_expr_node_evaluate(ctx, node->args[1], in, n_in, buf_ptr); + rc = grn_ts_expr_node_evaluate_to_buf(ctx, node->args[1], in, n_in, buf); if (rc != GRN_SUCCESS) { return rc; } + buf_ptr = (grn_ts_bool *)buf->ptr; for (i = 0; i < n_in; i++) { out_ptr[i] &= buf_ptr[i]; } @@ -2049,21 +2045,17 @@ grn_ts_op_logical_or_evaluate(grn_ctx *ctx, grn_ts_expr_op_node *node, const grn_ts_record *in, size_t n_in, void *out) { size_t i; - grn_ts_bool *out_ptr = (grn_ts_bool *)out; - grn_ts_bool *buf_ptr; + grn_ts_buf *buf = &node->bufs[0]; + grn_ts_bool *buf_ptr, *out_ptr = (grn_ts_bool *)out; grn_rc rc = grn_ts_expr_node_evaluate(ctx, node->args[0], in, n_in, out); if (rc != GRN_SUCCESS) { return rc; } - rc = grn_ts_buf_reserve(ctx, &node->bufs[0], sizeof(grn_ts_bool) * n_in); - if (rc != GRN_SUCCESS) { - return rc; - } - buf_ptr = (grn_ts_bool *)node->bufs[0].ptr; - rc = grn_ts_expr_node_evaluate(ctx, node->args[1], in, n_in, buf_ptr); + rc = grn_ts_expr_node_evaluate_to_buf(ctx, node->args[1], in, n_in, buf); if (rc != GRN_SUCCESS) { return rc; } + buf_ptr = (grn_ts_bool *)buf->ptr; for (i = 0; i < n_in; i++) { out_ptr[i] |= buf_ptr[i]; } -------------- next part -------------- HTML����������������������������... Download