[Groonga-commit] groonga/groonga at 9d549de [master] Use grn_oeprator_exec_equal() instead of grn_expr and GRN_OP_EQUAL

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Feb 8 19:19:49 JST 2015


Kouhei Sutou	2015-02-08 19:19:49 +0900 (Sun, 08 Feb 2015)

  New Revision: 9d549deae8ab1e681e12507c526b599363ea5d19
  https://github.com/groonga/groonga/commit/9d549deae8ab1e681e12507c526b599363ea5d19

  Message:
    Use grn_oeprator_exec_equal() instead of grn_expr and GRN_OP_EQUAL

  Modified files:
    lib/proc.c

  Modified: lib/proc.c (+4 -15)
===================================================================
--- lib/proc.c    2015-02-08 19:19:25 +0900 (d8b9de8)
+++ lib/proc.c    2015-02-08 19:19:49 +0900 (b72b2e2)
@@ -5931,25 +5931,14 @@ func_in_values(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data
   target_value = args[0];
   for (i = 1; i < nargs; i++) {
     grn_obj *value = args[i];
-    grn_obj *equal_condition;
-    grn_obj *result;
-    grn_bool result_boolean = GRN_FALSE;
-
-    /* TODO: Implement grn_obj_equal() and use it. */
-    equal_condition = grn_expr_create(ctx, NULL, 0);
-    grn_expr_append_const(ctx, equal_condition, target_value, GRN_OP_PUSH, 1);
-    grn_expr_append_const(ctx, equal_condition, value, GRN_OP_PUSH, 1);
-    grn_expr_append_op(ctx, equal_condition, GRN_OP_EQUAL, 2);
-    result = grn_expr_exec(ctx, equal_condition, 0);
+    grn_bool result;
+
+    result = grn_operator_exec_equal(ctx, target_value, value);
     if (ctx->rc) {
       break;
     }
-    if (result) {
-      GRN_TRUEP(ctx, result, result_boolean);
-    }
-    grn_obj_unlink(ctx, equal_condition);
 
-    if (result_boolean) {
+    if (result) {
       GRN_BOOL_SET(ctx, found, GRN_TRUE);
       break;
     }
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index