[Groonga-commit] groonga/groonga at 1130d6b [master] Fix a bug that GRN_OBJ_KEY_LARGE conflicts with existing flag

Zurück zum Archiv-Index

Kouhei Sutou null+****@clear*****
Mon Apr 25 19:12:43 JST 2016


Kouhei Sutou	2016-04-25 19:12:43 +0900 (Mon, 25 Apr 2016)

  New Revision: 1130d6bc080d9cfbb0a5eef551fba8acfb90fc35
  https://github.com/groonga/groonga/commit/1130d6bc080d9cfbb0a5eef551fba8acfb90fc35

  Message:
    Fix a bug that GRN_OBJ_KEY_LARGE conflicts with existing flag
    
    This change is backward incompatible but the current behavior is a bug.
    So we change this.
    
    Table that is created with TABLE_HASH_KEY|KEY_LARGE flag without this
    change may break database. It's recommend that you recreate the table.
    
    This change introduces backward compatible API change. But it may report
    warning by C compiler. grn_table_create() uses grn_table_flags instead
    of grn_obj_flags. grn_table_flags is unsigned 32bit
    integer. grn_obj_flags is unsigned 16bit integer.
    
    Normally, unsigned 16bit integer is handled like unsigned 32bit
    integer. So API and ABI is compatible. But C compiler may report
    warnings.

  Modified files:
    include/groonga/dump.h
    include/groonga/groonga.h
    lib/db.c
    lib/dump.c
    lib/grn_db.h
    lib/grn_hash.h
    lib/hash.c
    lib/ii.c
    lib/index_column.c
    lib/proc.c
    lib/proc/proc_schema.c
    lib/proc/proc_table.c
    lib/token_cursor.c
    lib/tokenizer.c

  Modified: include/groonga/dump.h (+1 -1)
===================================================================
--- include/groonga/dump.h    2016-04-25 19:05:04 +0900 (3427bf1)
+++ include/groonga/dump.h    2016-04-25 19:12:43 +0900 (d490c38)
@@ -23,7 +23,7 @@ extern "C" {
 #endif
 
 GRN_API grn_rc grn_dump_table_create_flags(grn_ctx *ctx,
-                                           grn_obj_flags flags,
+                                           grn_table_flags flags,
                                            grn_obj *buffer);
 GRN_API grn_rc grn_dump_column_create_flags(grn_ctx *ctx,
                                             grn_obj_flags flags,

  Modified: include/groonga/groonga.h (+11 -2)
===================================================================
--- include/groonga/groonga.h    2016-04-25 19:05:04 +0900 (9cb3102)
+++ include/groonga/groonga.h    2016-04-25 19:12:43 +0900 (e5f9202)
@@ -292,6 +292,11 @@ GRN_API grn_encoding grn_encoding_parse(const char *name);
 /* obj */
 
 typedef uint16_t grn_obj_flags;
+typedef uint32_t grn_table_flags;
+
+/* flags for grn_obj_flags and grn_table_flags */
+
+#define GRN_OBJ_FLAGS_MASK             (0xffff)
 
 #define GRN_OBJ_TABLE_TYPE_MASK        (0x07)
 #define GRN_OBJ_TABLE_HASH_KEY         (0x00)
@@ -336,7 +341,7 @@ typedef uint16_t grn_obj_flags;
 #define GRN_OBJ_UNIT_USERDEF_SECTION   (0x07<<8)
 #define GRN_OBJ_UNIT_USERDEF_POSITION  (0x08<<8)
 
-#define GRN_OBJ_KEY_LARGE              (0x01<<12)
+/* Don't use (0x01<<12) because it's used internally. */
 
 #define GRN_OBJ_NO_SUBREC              (0x00<<13)
 #define GRN_OBJ_WITH_SUBREC            (0x01<<13)
@@ -346,6 +351,10 @@ typedef uint16_t grn_obj_flags;
 #define GRN_OBJ_TEMPORARY              (0x00<<15)
 #define GRN_OBJ_PERSISTENT             (0x01<<15)
 
+/* flags only for grn_table_flags */
+
+#define GRN_OBJ_KEY_LARGE              (0x01<<16)
+
 /* obj types */
 
 #define GRN_VOID                       (0x00)
@@ -534,7 +543,7 @@ GRN_API grn_proc_type grn_proc_get_type(grn_ctx *ctx, grn_obj *proc);
 
 GRN_API grn_obj *grn_table_create(grn_ctx *ctx,
                                   const char *name, unsigned int name_size,
-                                  const char *path, grn_obj_flags flags,
+                                  const char *path, grn_table_flags flags,
                                   grn_obj *key_type, grn_obj *value_type);
 
 #define GRN_TABLE_OPEN_OR_CREATE(ctx,name,name_size,path,flags,key_type,value_type,table) \

  Modified: lib/db.c (+12 -12)
===================================================================
--- lib/db.c    2016-04-25 19:05:04 +0900 (4ce0ff2)
+++ lib/db.c    2016-04-25 19:12:43 +0900 (b2afa44)
@@ -825,7 +825,7 @@ grn_proc_create(grn_ctx *ctx, const char *name, int name_size, grn_proc_type typ
 /* grn_table */
 
 static void
-calc_rec_size(grn_obj_flags flags, uint32_t max_n_subrecs, uint32_t range_size,
+calc_rec_size(grn_table_flags flags, uint32_t max_n_subrecs, uint32_t range_size,
               uint32_t additional_value_size,
               uint8_t *subrec_size, uint8_t *subrec_offset,
               uint32_t *key_size, uint32_t *value_size)
@@ -877,10 +877,10 @@ static grn_rc _grn_obj_remove(grn_ctx *ctx, grn_obj *obj, grn_bool dependent);
 
 static grn_rc
 grn_table_create_validate(grn_ctx *ctx, const char *name, unsigned int name_size,
-                          const char *path, grn_obj_flags flags,
+                          const char *path, grn_table_flags flags,
                           grn_obj *key_type, grn_obj *value_type)
 {
-  grn_obj_flags table_type;
+  grn_table_flags table_type;
   const char *table_type_name = NULL;
 
   table_type = (flags & GRN_OBJ_TABLE_TYPE_MASK);
@@ -951,7 +951,7 @@ grn_table_create_validate(grn_ctx *ctx, const char *name, unsigned int name_size
 static grn_obj *
 grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
                                     unsigned int name_size, const char *path,
-                                    grn_obj_flags flags, grn_obj *key_type,
+                                    grn_table_flags flags, grn_obj *key_type,
                                     grn_obj *value_type,
                                     uint32_t max_n_subrecs,
                                     uint32_t additional_value_size)
@@ -1128,7 +1128,7 @@ grn_table_create_with_max_n_subrecs(grn_ctx *ctx, const char *name,
 
 grn_obj *
 grn_table_create(grn_ctx *ctx, const char *name, unsigned int name_size,
-                 const char *path, grn_obj_flags flags,
+                 const char *path, grn_table_flags flags,
                  grn_obj *key_type, grn_obj *value_type)
 {
   grn_obj *res;
@@ -2172,7 +2172,7 @@ exit :
 }
 
 grn_rc
-grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
+grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_table_flags *flags,
                    grn_encoding *encoding, grn_obj **tokenizer,
                    grn_obj **normalizer,
                    grn_obj **token_filters)
@@ -2182,7 +2182,7 @@ grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
   if (table) {
     switch (table->header.type) {
     case GRN_TABLE_PAT_KEY :
-      if (flags) { *flags = ((grn_pat *)table)->obj.header.flags; }
+      if (flags) { *flags = ((grn_pat *)table)->header->flags; }
       if (encoding) { *encoding = ((grn_pat *)table)->encoding; }
       if (tokenizer) { *tokenizer = ((grn_pat *)table)->tokenizer; }
       if (normalizer) { *normalizer = ((grn_pat *)table)->normalizer; }
@@ -2190,7 +2190,7 @@ grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
       rc = GRN_SUCCESS;
       break;
     case GRN_TABLE_DAT_KEY :
-      if (flags) { *flags = ((grn_dat *)table)->obj.header.flags; }
+      if (flags) { *flags = ((grn_dat *)table)->header->flags; }
       if (encoding) { *encoding = ((grn_dat *)table)->encoding; }
       if (tokenizer) { *tokenizer = ((grn_dat *)table)->tokenizer; }
       if (normalizer) { *normalizer = ((grn_dat *)table)->normalizer; }
@@ -2198,7 +2198,7 @@ grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
       rc = GRN_SUCCESS;
       break;
     case GRN_TABLE_HASH_KEY :
-      if (flags) { *flags = ((grn_hash *)table)->obj.header.flags; }
+      if (flags) { *flags = ((grn_hash *)table)->header.common->flags; }
       if (encoding) { *encoding = ((grn_hash *)table)->encoding; }
       if (tokenizer) { *tokenizer = ((grn_hash *)table)->tokenizer; }
       if (normalizer) { *normalizer = ((grn_hash *)table)->normalizer; }
@@ -2206,9 +2206,9 @@ grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
       rc = GRN_SUCCESS;
       break;
     case GRN_TABLE_NO_KEY :
-      if (flags) { *flags = 0; }
+      if (flags) { *flags = grn_array_get_flags(ctx, ((grn_array *)table)); }
       if (encoding) { *encoding = GRN_ENC_NONE; }
-      if (tokenizer) { *tokenizer = grn_tokenizer_uvector; }
+      if (tokenizer) { *tokenizer = NULL; }
       if (normalizer) { *normalizer = NULL; }
       if (token_filters) { *token_filters = NULL; }
       rc = GRN_SUCCESS;
@@ -4188,7 +4188,7 @@ grn_table_group(grn_ctx *ctx, grn_obj *table,
     }
     for (r = 0, rp = results; r < n_results; r++, rp++) {
       if (!rp->table) {
-        grn_obj_flags flags;
+        grn_table_flags flags;
         grn_obj *key_type = NULL;
         uint32_t additional_value_size;
 

  Modified: lib/dump.c (+1 -1)
===================================================================
--- lib/dump.c    2016-04-25 19:05:04 +0900 (594213c)
+++ lib/dump.c    2016-04-25 19:12:43 +0900 (d38d010)
@@ -20,7 +20,7 @@
 
 grn_rc
 grn_dump_table_create_flags(grn_ctx *ctx,
-                            grn_obj_flags flags,
+                            grn_table_flags flags,
                             grn_obj *buffer)
 {
   GRN_API_ENTER;

  Modified: lib/grn_db.h (+1 -1)
===================================================================
--- lib/grn_db.h    2016-04-25 19:05:04 +0900 (e9799fd)
+++ lib/grn_db.h    2016-04-25 19:12:43 +0900 (75c0431)
@@ -73,7 +73,7 @@ grn_id grn_table_get_v(grn_ctx *ctx, grn_obj *table, const void *key, int key_si
                        void **value);
 grn_id grn_table_add_v(grn_ctx *ctx, grn_obj *table, const void *key, int key_size,
                        void **value, int *added);
-GRN_API grn_rc grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_obj_flags *flags,
+GRN_API grn_rc grn_table_get_info(grn_ctx *ctx, grn_obj *table, grn_table_flags *flags,
                                   grn_encoding *encoding, grn_obj **tokenizer,
                                   grn_obj **normalizer,
                                   grn_obj **token_filters);

  Modified: lib/grn_hash.h (+2 -0)
===================================================================
--- lib/grn_hash.h    2016-04-25 19:05:04 +0900 (c26d0c1)
+++ lib/grn_hash.h    2016-04-25 19:12:43 +0900 (6e851c2)
@@ -164,6 +164,8 @@ struct _grn_array_cursor {
  */
 uint32_t grn_array_size(grn_ctx *ctx, grn_array *array);
 
+uint32_t grn_array_get_flags(grn_ctx *ctx, grn_array *array);
+
 grn_rc grn_array_truncate(grn_ctx *ctx, grn_array *array);
 grn_rc grn_array_copy_sort_key(grn_ctx *ctx, grn_array *array,
                                grn_table_sort_key *keys, int n_keys);

  Modified: lib/hash.c (+7 -1)
===================================================================
--- lib/hash.c    2016-04-25 19:05:04 +0900 (db2e41b)
+++ lib/hash.c    2016-04-25 19:12:43 +0900 (8a88cc3)
@@ -665,6 +665,12 @@ grn_array_size(grn_ctx *ctx, grn_array *array)
   return *array->n_entries;
 }
 
+uint32_t
+grn_array_get_flags(grn_ctx *ctx, grn_array *array)
+{
+  return array->header->flags;
+}
+
 grn_rc
 grn_array_truncate(grn_ctx *ctx, grn_array *array)
 {
@@ -1867,7 +1873,7 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path,
     grn_table_queue_init(ctx, queue);
   }
 
-  hash->obj.header.flags = header->flags;
+  hash->obj.header.flags = (header->flags & GRN_OBJ_FLAGS_MASK);
   hash->ctx = ctx;
   hash->encoding = encoding;
   hash->value_size = value_size;

  Modified: lib/ii.c (+6 -6)
===================================================================
--- lib/ii.c    2016-04-25 19:05:04 +0900 (414c9b3)
+++ lib/ii.c    2016-04-25 19:12:43 +0900 (0e091e7)
@@ -3683,7 +3683,7 @@ _grn_ii_create(grn_ctx *ctx, grn_ii *ii, const char *path, grn_obj *lexicon, uin
   grn_io *seg, *chunk;
   char path2[PATH_MAX];
   struct grn_ii_header *header;
-  grn_obj_flags lflags;
+  grn_table_flags lflags;
   grn_encoding encoding;
   grn_obj *tokenizer;
   /*
@@ -3815,7 +3815,7 @@ grn_ii_open(grn_ctx *ctx, const char *path, grn_obj *lexicon)
   char path2[PATH_MAX];
   struct grn_ii_header *header;
   uint32_t io_type;
-  grn_obj_flags lflags;
+  grn_table_flags lflags;
   grn_encoding encoding;
   grn_obj *tokenizer;
   if (grn_table_get_info(ctx, lexicon, &lflags, &encoding, &tokenizer,
@@ -7779,7 +7779,7 @@ get_tmp_lexicon(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
     grn_obj *tokenizer;
     grn_obj *normalizer;
     grn_obj *token_filters;
-    grn_obj_flags flags;
+    grn_table_flags flags;
     grn_table_get_info(ctx, ii_buffer->lexicon, &flags, NULL,
                        &tokenizer, &normalizer, &token_filters);
     flags &= ~GRN_OBJ_PERSISTENT;
@@ -8312,7 +8312,7 @@ grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
           ii_buffer->block_buf_size = II_BUFFER_BLOCK_SIZE;
           ii_buffer->tmpfd = grn_mkstemp(ii_buffer->tmpfpath);
           if (ii_buffer->tmpfd != -1) {
-            grn_obj_flags flags;
+            grn_table_flags flags;
             grn_table_get_info(ctx, ii->lexicon, &flags, NULL, NULL, NULL,
                                NULL);
             if ((flags & GRN_OBJ_TABLE_TYPE_MASK) == GRN_OBJ_TABLE_PAT_KEY) {
@@ -8525,7 +8525,7 @@ grn_rc
 grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer)
 {
   uint32_t i;
-  grn_obj_flags flags;
+  grn_table_flags flags;
   grn_table_get_info(ctx, ii_buffer->ii->lexicon, &flags, NULL, NULL, NULL,
                      NULL);
   if ((flags & GRN_OBJ_TABLE_TYPE_MASK) == GRN_OBJ_TABLE_PAT_KEY) {
@@ -9653,7 +9653,7 @@ grn_ii_builder_close(grn_ctx *ctx, grn_ii_builder *builder)
 static grn_rc
 grn_ii_builder_create_lexicon(grn_ctx *ctx, grn_ii_builder *builder)
 {
-  grn_obj_flags flags;
+  grn_table_flags flags;
   grn_obj *domain = grn_ctx_at(ctx, builder->ii->lexicon->header.domain);
   grn_obj *range = grn_ctx_at(ctx, DB_OBJ(builder->ii->lexicon)->range);
   grn_obj *tokenizer, *normalizer, *token_filters;

  Modified: lib/index_column.c (+1 -1)
===================================================================
--- lib/index_column.c    2016-04-25 19:05:04 +0900 (1cb7cd5)
+++ lib/index_column.c    2016-04-25 19:12:43 +0900 (f43caf5)
@@ -105,7 +105,7 @@ grn_index_column_build(grn_ctx *ctx, grn_obj *index_column)
     target = GRN_OBJ_TABLEP(src) ? src : grn_ctx_at(ctx, src->header.domain);
     if (target) {
       int i, ncol = DB_OBJ(index_column)->source_size / sizeof(grn_id);
-      grn_obj_flags flags;
+      grn_table_flags flags;
       grn_ii *ii = (grn_ii *)index_column;
       grn_bool use_grn_ii_build;
       grn_obj *tokenizer = NULL;

  Modified: lib/proc.c (+13 -11)
===================================================================
--- lib/proc.c    2016-04-25 19:05:04 +0900 (41ff643)
+++ lib/proc.c    2016-04-25 19:12:43 +0900 (2bf67a0)
@@ -988,9 +988,11 @@ dump_table(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
            grn_obj *pending_reference_columns)
 {
   grn_obj *domain = NULL, *range = NULL;
-  grn_obj_flags default_flags = GRN_OBJ_PERSISTENT;
+  grn_table_flags flags;
+  grn_table_flags default_flags = GRN_OBJ_PERSISTENT;
   grn_obj *default_tokenizer;
   grn_obj *normalizer;
+  grn_obj *token_filters;
 
   switch (table->header.type) {
   case GRN_TABLE_HASH_KEY:
@@ -1007,11 +1009,18 @@ dump_table(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
     grn_ctx_output_flush(ctx, 0);
   }
 
+  grn_table_get_info(ctx, table,
+                     &flags,
+                     NULL,
+                     &default_tokenizer,
+                     &normalizer,
+                     &token_filters);
+
   GRN_TEXT_PUTS(ctx, outbuf, "table_create ");
   dump_obj_name(ctx, outbuf, table);
   GRN_TEXT_PUTC(ctx, outbuf, ' ');
   grn_dump_table_create_flags(ctx,
-                              table->header.flags & ~default_flags,
+                              flags & ~default_flags,
                               outbuf);
   if (domain) {
     GRN_TEXT_PUTC(ctx, outbuf, ' ');
@@ -1031,36 +1040,29 @@ dump_table(grn_ctx *ctx, grn_obj *outbuf, grn_obj *table,
     dump_obj_name(ctx, outbuf, range);
     grn_obj_unlink(ctx, range);
   }
-  default_tokenizer = grn_obj_get_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER,
-                                       NULL);
   if (default_tokenizer) {
     GRN_TEXT_PUTS(ctx, outbuf, " --default_tokenizer ");
     dump_obj_name(ctx, outbuf, default_tokenizer);
   }
-  normalizer = grn_obj_get_info(ctx, table, GRN_INFO_NORMALIZER, NULL);
   if (normalizer) {
     GRN_TEXT_PUTS(ctx, outbuf, " --normalizer ");
     dump_obj_name(ctx, outbuf, normalizer);
   }
   if (table->header.type != GRN_TABLE_NO_KEY) {
-    grn_obj token_filters;
     int n_token_filters;
 
-    GRN_PTR_INIT(&token_filters, GRN_OBJ_VECTOR, GRN_ID_NIL);
-    grn_obj_get_info(ctx, table, GRN_INFO_TOKEN_FILTERS, &token_filters);
-    n_token_filters = GRN_BULK_VSIZE(&token_filters) / sizeof(grn_obj *);
+    n_token_filters = GRN_BULK_VSIZE(token_filters) / sizeof(grn_obj *);
     if (n_token_filters > 0) {
       int i;
       GRN_TEXT_PUTS(ctx, outbuf, " --token_filters ");
       for (i = 0; i < n_token_filters; i++) {
-        grn_obj *token_filter = GRN_PTR_VALUE_AT(&token_filters, i);
+        grn_obj *token_filter = GRN_PTR_VALUE_AT(token_filters, i);
         if (i > 0) {
           GRN_TEXT_PUTC(ctx, outbuf, ',');
         }
         dump_obj_name(ctx, outbuf, token_filter);
       }
     }
-    GRN_OBJ_FIN(ctx, &token_filters);
   }
 
   GRN_TEXT_PUTC(ctx, outbuf, '\n');

  Modified: lib/proc/proc_schema.c (+4 -2)
===================================================================
--- lib/proc/proc_schema.c    2016-04-25 19:05:04 +0900 (eeb20c0)
+++ lib/proc/proc_schema.c    2016-04-25 19:12:43 +0900 (478cca3)
@@ -461,10 +461,12 @@ command_schema_table_command_collect_arguments(grn_ctx *ctx,
 
   {
     grn_obj flags;
-    grn_obj_flags ignored_flags = GRN_OBJ_KEY_NORMALIZE | GRN_OBJ_PERSISTENT;
+    grn_table_flags table_flags;
+    grn_table_flags ignored_flags = GRN_OBJ_KEY_NORMALIZE | GRN_OBJ_PERSISTENT;
     GRN_TEXT_INIT(&flags, 0);
+    grn_table_get_info(ctx, table, &table_flags, NULL, NULL, NULL, NULL);
     grn_dump_table_create_flags(ctx,
-                                table->header.flags & ~ignored_flags,
+                                table_flags & ~ignored_flags,
                                 &flags);
     GRN_TEXT_PUTC(ctx, &flags, '\0');
     ADD("flags", GRN_TEXT_VALUE(&flags));

  Modified: lib/proc/proc_table.c (+14 -8)
===================================================================
--- lib/proc/proc_table.c    2016-04-25 19:05:04 +0900 (3da438b)
+++ lib/proc/proc_table.c    2016-04-25 19:12:43 +0900 (b94aa14)
@@ -20,15 +20,16 @@
 
 #include "../grn_ctx.h"
 #include "../grn_str.h"
+#include "../grn_db.h"
 
 #include <groonga/plugin.h>
 
-static grn_obj_flags
+static grn_table_flags
 command_table_create_parse_flags(grn_ctx *ctx,
                                  const char *nptr,
                                  const char *end)
 {
-  grn_obj_flags flags = 0;
+  grn_table_flags flags = 0;
   while (nptr < end) {
     size_t name_size;
 
@@ -193,7 +194,7 @@ command_table_create(grn_ctx *ctx,
   grn_obj *token_filters;
   grn_obj *table;
   const char *rest;
-  grn_obj_flags flags;
+  grn_table_flags flags;
 
   name = grn_plugin_proc_get_var(ctx, user_data, "name", -1);
   flags_raw = grn_plugin_proc_get_var(ctx, user_data, "flags", -1);
@@ -308,8 +309,10 @@ output_table_info(grn_ctx *ctx, grn_obj *table)
   grn_id id;
   grn_obj o;
   const char *path;
+  grn_table_flags flags;
   grn_obj *default_tokenizer;
   grn_obj *normalizer;
+  grn_obj *token_filters;
 
   id = grn_obj_id(ctx, table);
   path = grn_obj_path(ctx, table);
@@ -319,16 +322,19 @@ output_table_info(grn_ctx *ctx, grn_obj *table)
   grn_proc_output_object_id_name(ctx, id);
   grn_ctx_output_cstr(ctx, path);
   GRN_BULK_REWIND(&o);
-  grn_dump_table_create_flags(ctx, table->header.flags, &o);
+
+  grn_table_get_info(ctx, table,
+                     &flags,
+                     NULL,
+                     &default_tokenizer,
+                     &normalizer,
+                     &token_filters);
+  grn_dump_table_create_flags(ctx, flags, &o);
   grn_ctx_output_obj(ctx, &o, NULL);
   grn_proc_output_object_id_name(ctx, table->header.domain);
   grn_proc_output_object_id_name(ctx, grn_obj_get_range(ctx, table));
-  default_tokenizer = grn_obj_get_info(ctx, table, GRN_INFO_DEFAULT_TOKENIZER,
-                                       NULL);
   grn_proc_output_object_name(ctx, default_tokenizer);
-  normalizer = grn_obj_get_info(ctx, table, GRN_INFO_NORMALIZER, NULL);
   grn_proc_output_object_name(ctx, normalizer);
-  grn_obj_unlink(ctx, normalizer);
   grn_ctx_output_array_close(ctx);
   GRN_OBJ_FIN(ctx, &o);
   return 1;

  Modified: lib/token_cursor.c (+1 -1)
===================================================================
--- lib/token_cursor.c    2016-04-25 19:05:04 +0900 (c974eba)
+++ lib/token_cursor.c    2016-04-25 19:12:43 +0900 (c2f8890)
@@ -54,7 +54,7 @@ grn_token_cursor_open(grn_ctx *ctx, grn_obj *table,
   grn_obj *tokenizer;
   grn_obj *normalizer;
   grn_obj *token_filters;
-  grn_obj_flags table_flags;
+  grn_table_flags table_flags;
   if (grn_table_get_info(ctx, table, &table_flags, &encoding, &tokenizer,
                          &normalizer, &token_filters)) {
     return NULL;

  Modified: lib/tokenizer.c (+1 -1)
===================================================================
--- lib/tokenizer.c    2016-04-25 19:05:04 +0900 (e72d3b4)
+++ lib/tokenizer.c    2016-04-25 19:12:43 +0900 (c247efd)
@@ -134,7 +134,7 @@ grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args,
 
     {
       grn_obj * const table = args[0];
-      grn_obj_flags table_flags;
+      grn_table_flags table_flags;
       grn_encoding table_encoding;
       unsigned int query_length = GRN_TEXT_LEN(query_str);
       char *query_buf = (char *)GRN_PLUGIN_MALLOC(ctx, query_length + 1);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index