[Groonga-commit] groonga/groonga at d669243 [master] grn_ts: initialize buffer (grn_obj) with the correct domain

Back to archive index

susumu.yata null+****@clear*****
Fri Sep 4 12:08:15 JST 2015


susumu.yata	2015-09-04 12:08:15 +0900 (Fri, 04 Sep 2015)

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

  Message:
    grn_ts: initialize buffer (grn_obj) with the correct domain

  Modified files:
    lib/ts.c

  Modified: lib/ts.c (+31 -1)
===================================================================
--- lib/ts.c    2015-09-04 11:35:03 +0900 (d9a69c8)
+++ lib/ts.c    2015-09-04 12:08:15 +0900 (3ffe733)
@@ -786,6 +786,11 @@ grn_ts_expr_const_node_open(grn_ctx *ctx, grn_ts_data_kind kind,
   return GRN_SUCCESS;
 }
 
+#define GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(TYPE)\
+  case GRN_DB_ ## TYPE: {\
+    GRN_ ## TYPE ## _INIT(&new_node->buf, GRN_OBJ_VECTOR);\
+    break;\
+  }
 /* grn_ts_expr_column_node_open() creates a node associated with a column. */
 static grn_rc
 grn_ts_expr_column_node_open(grn_ctx *ctx, grn_obj *column,
@@ -811,11 +816,36 @@ grn_ts_expr_column_node_open(grn_ctx *ctx, grn_obj *column,
   }
   new_node->data_type = DB_OBJ(column)->range;
   new_node->column = column;
-  GRN_TEXT_INIT(&new_node->buf, 0);
+  if (new_node->data_kind & GRN_TS_VECTOR_FLAG) {
+    switch (new_node->data_type) {
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(BOOL)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(INT8)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(INT16)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(INT32)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(INT64)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(UINT8)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(UINT16)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(UINT32)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(UINT64)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(FLOAT)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(TIME)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(SHORT_TEXT)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(TEXT)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(LONG_TEXT)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(TOKYO_GEO_POINT)
+      GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK(WGS84_GEO_POINT)
+      default: {
+        break;
+      }
+    }
+  } else {
+    GRN_TEXT_INIT(&new_node->buf, 0);
+  }
   new_node->body.buf = NULL;
   *node = (grn_ts_expr_node *)new_node;
   return GRN_SUCCESS;
 }
+#undef GRN_TS_EXPR_COLUMN_NODE_OPEN_CASE_BLOCK
 
 /* grn_ts_expr_id_node_evaluate() outputs IDs. */
 static grn_rc
-------------- next part --------------
HTML����������������������������...
Download 



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