[Groonga-commit] groonga/groonga at dc52bd7 [master] Update res after operation only when it is optimized case

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jun 19 14:50:12 JST 2013


Kouhei Sutou	2013-06-19 14:50:12 +0900 (Wed, 19 Jun 2013)

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

  Message:
    Update res after operation only when it is optimized case
    
    Normally, res is updated before operation.

  Modified files:
    lib/expr.c

  Modified: lib/expr.c (+6 -1)
===================================================================
--- lib/expr.c    2013-06-19 12:37:21 +0900 (315c976)
+++ lib/expr.c    2013-06-19 14:50:12 +0900 (aaa6b14)
@@ -2212,6 +2212,9 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
   grn_obj *x, *y;                                                       \
                                                                         \
   POP2ALLOC1(x, y, res);                                                \
+  if (y != res) {                                                       \
+    res->header.domain = x->header.domain;                              \
+  }                                                                     \
   ARITHMETIC_OPERATION_DISPATCH(x, y, res,                              \
                                 integer8_operation,                     \
                                 integer16_operation,                    \
@@ -2222,7 +2225,9 @@ grn_proc_call(grn_ctx *ctx, grn_obj *proc, int nargs, grn_obj *caller)
                                 right_expression_check,                 \
                                 text_operation,                         \
                                 invalid_type_error);                    \
-  res->header.domain = x->header.domain;                                \
+  if (y == res) {                                                       \
+    res->header.domain = x->header.domain;                              \
+  }                                                                     \
 } while (0)
 
 #define ARITHMETIC_UNARY_OPERATION_DISPATCH(integer_operation,          \
-------------- next part --------------
HTML����������������������������...
Download 



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