[Groonga-commit] groonga/groonga at de02873 [master] Use GRN_TRUEP() for "||" operation

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Mon May 20 19:00:59 JST 2013


Kouhei Sutou	2013-05-20 19:00:59 +0900 (Mon, 20 May 2013)

  New Revision: de0287329ed8d7a4ca5d286d2262c154ed248bd2
  https://github.com/groonga/groonga/commit/de0287329ed8d7a4ca5d286d2262c154ed248bd2

  Message:
    Use GRN_TRUEP() for "||" operation

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+6 -3)
===================================================================
--- lib/expr.c    2013-05-20 18:58:54 +0900 (246b182)
+++ lib/expr.c    2013-05-20 19:00:59 +0900 (614cda9)
@@ -3140,12 +3140,15 @@ grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs)
       case GRN_OP_OR :
         {
           grn_obj *x, *y;
+          unsigned int x_boolean, y_boolean;
           int result;
           POP2ALLOC1(x, y, res);
-          if (GRN_INT32_VALUE(x) == 0 && GRN_INT32_VALUE(y) == 0) {
-            result = 0;
-          } else {
+          GRN_TRUEP(ctx, x, x_boolean);
+          GRN_TRUEP(ctx, y, y_boolean);
+          if (x_boolean || y_boolean) {
             result = 1;
+          } else {
+            result = 0;
           }
           grn_obj_reinit(ctx, res, GRN_DB_INT32, 0);
           GRN_INT32_SET(ctx, res, result);
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る