[Groonga-commit] groonga/groonga at 31ff2fd [master] grn_ts: fix a bug of a comparison operator "!="

Back to archive index

susumu.yata null+****@clear*****
Tue Sep 15 09:04:42 JST 2015


susumu.yata	2015-09-15 09:04:42 +0900 (Tue, 15 Sep 2015)

  New Revision: 31ff2fdc5c29a7f421b7dd92725ddb35618a4a1e
  https://github.com/groonga/groonga/commit/31ff2fdc5c29a7f421b7dd92725ddb35618a4a1e

  Message:
    grn_ts: fix a bug of a comparison operator "!="
    
    GitHub: #386

  Modified files:
    lib/ts.c

  Modified: lib/ts.c (+6 -4)
===================================================================
--- lib/ts.c    2015-09-15 08:57:09 +0900 (7462f25)
+++ lib/ts.c    2015-09-15 09:04:42 +0900 (d8bc009)
@@ -572,6 +572,8 @@ grn_ts_op_get_n_args(grn_ts_op_type op_type) {
   }
 }
 
+/* FIXME: The following implementation assumes that NaN values don't appear. */
+
 /* grn_ts_op_equal_bool() returns lhs == rhs. */
 inline static grn_bool
 grn_ts_op_equal_bool(grn_ts_bool lhs, grn_ts_bool rhs) {
@@ -719,14 +721,14 @@ grn_ts_op_not_equal_ref(grn_ts_ref lhs, grn_ts_ref rhs) {
 #define GRN_TS_OP_NOT_EQUAL_VECTOR(kind)\
   size_t i;\
   if (lhs.size != rhs.size) {\
-    return GRN_FALSE;\
+    return GRN_TRUE;\
   }\
   for (i = 0; i < lhs.size; i++) {\
-    if (!grn_ts_op_not_equal_ ## kind(lhs.ptr[i], rhs.ptr[i])) {\
-      return GRN_FALSE;\
+    if (grn_ts_op_not_equal_ ## kind(lhs.ptr[i], rhs.ptr[i])) {\
+      return GRN_TRUE;\
     }\
   }\
-  return GRN_TRUE;
+  return GRN_FALSE;
 /* grn_ts_op_not_equal_bool_vector() returns lhs != rhs. */
 inline static grn_bool
 grn_ts_op_not_equal_bool_vector(grn_ts_bool_vector lhs,
-------------- next part --------------
HTML����������������������������...
下載 



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