[Groonga-commit] groonga/groonga [master] Revert "[normalizer] support grn_obj_set_info()/grn_obj_get_info() API."

Back to archive index

null+****@clear***** null+****@clear*****
2012年 2月 14日 (火) 13:59:55 JST


Kouhei Sutou	2012-02-14 13:59:55 +0900 (Tue, 14 Feb 2012)

  New Revision: 0e0c9983c9c96eea03d0ad7a3fe914852ebcd9f7

  Log:
    Revert "[normalizer] support grn_obj_set_info()/grn_obj_get_info() API."
    
    This reverts commit 4b650057a9a01501ef389549b66b36bd11cf7f84.

  Modified files:
    include/groonga.h
    lib/db.c
    test/unit/core/test-table.c

  Modified: include/groonga.h (+1 -2)
===================================================================
--- include/groonga.h    2012-02-14 13:59:25 +0900 (55dc855)
+++ include/groonga.h    2012-02-14 13:59:55 +0900 (af759e8)
@@ -1363,8 +1363,7 @@ typedef enum {
   GRN_INFO_PARTIAL_MATCH_THRESHOLD,
   GRN_INFO_II_SPLIT_THRESHOLD,
   GRN_INFO_SUPPORT_ZLIB,
-  GRN_INFO_SUPPORT_LZO,
-  GRN_INFO_NORMALIZER
+  GRN_INFO_SUPPORT_LZO
 } grn_info_type;
 
 /**

  Modified: lib/db.c (+0 -35)
===================================================================
--- lib/db.c    2012-02-14 13:59:25 +0900 (30c10fa)
+++ lib/db.c    2012-02-14 13:59:55 +0900 (99099a7)
@@ -5712,19 +5712,6 @@ grn_obj_get_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *valueb
         break;
       }
       break;
-    case GRN_INFO_NORMALIZER :
-      switch (DB_OBJ(obj)->header.type) {
-      case GRN_TABLE_HASH_KEY :
-        valuebuf = ((grn_hash *)obj)->normalizer;
-        break;
-      case GRN_TABLE_PAT_KEY :
-        valuebuf = ((grn_pat *)obj)->normalizer;
-        break;
-      case GRN_TABLE_DAT_KEY :
-        valuebuf = ((grn_dat *)obj)->normalizer;
-        break;
-      }
-      break;
     default :
       /* todo */
       break;
@@ -6044,28 +6031,6 @@ grn_obj_set_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *value)
         break;
       }
     }
-    break;
-  case GRN_INFO_NORMALIZER :
-    if (!value || DB_OBJ(value)->header.type == GRN_PROC) {
-      switch (DB_OBJ(obj)->header.type) {
-      case GRN_TABLE_HASH_KEY :
-        ((grn_hash *)obj)->normalizer = value;
-        ((grn_hash *)obj)->header->normalizer = grn_obj_id(ctx, value);
-        rc = GRN_SUCCESS;
-        break;
-      case GRN_TABLE_PAT_KEY :
-        ((grn_pat *)obj)->normalizer = value;
-        ((grn_pat *)obj)->header->normalizer = grn_obj_id(ctx, value);
-        rc = GRN_SUCCESS;
-        break;
-      case GRN_TABLE_DAT_KEY :
-        ((grn_dat *)obj)->normalizer = value;
-        ((grn_dat *)obj)->header->normalizer = grn_obj_id(ctx, value);
-        rc = GRN_SUCCESS;
-        break;
-      }
-    }
-    break;
   default :
     /* todo */
     break;

  Modified: test/unit/core/test-table.c (+0 -48)
===================================================================
--- test/unit/core/test-table.c    2012-02-14 13:59:25 +0900 (f58352d)
+++ test/unit/core/test-table.c    2012-02-14 13:59:55 +0900 (ca8c1fd)
@@ -41,8 +41,6 @@ void data_truncate_anonymous(void);
 void test_truncate_anonymous(gconstpointer data);
 void data_truncate_named(void);
 void test_truncate_named(gconstpointer data);
-void data_normalizer(void);
-void test_normalizer(gpointer data);
 
 static gchar *tmp_directory;
 
@@ -611,49 +609,3 @@ test_truncate_named(gconstpointer data)
   cut_assert_equal_string("", GRN_TEXT_VALUE(&buffer));
   cut_assert_equal_uint(0, grn_table_size(context, table));
 }
-
-void
-data_normalizer(void)
-{
-#define ADD_DATA(label, flags)                                          \
-  cut_add_data(label, GINT_TO_POINTER(flags), NULL, NULL)
-
-  ADD_DATA("temporary: hash", GRN_OBJ_TABLE_HASH_KEY);
-  ADD_DATA("temporary: patricia trie", GRN_OBJ_TABLE_PAT_KEY);
-  ADD_DATA("temporary: double array trie", GRN_OBJ_TABLE_DAT_KEY);
-  ADD_DATA("hash", GRN_OBJ_TABLE_HASH_KEY | GRN_OBJ_PERSISTENT);
-  ADD_DATA("patricia trie", GRN_OBJ_TABLE_PAT_KEY | GRN_OBJ_PERSISTENT);
-  ADD_DATA("double array trie", GRN_OBJ_TABLE_DAT_KEY | GRN_OBJ_PERSISTENT);
-
-#undef ADD_DATA
-}
-
-void
-test_normalizer(gpointer data)
-{
-  grn_obj *table;
-  grn_obj_flags flags = GPOINTER_TO_INT(data);
-  grn_obj *normalizer = NULL;
-  const gchar *table_name = NULL;
-  unsigned int table_name_size = 0;
-  grn_obj *key_type;
-  char name[1024];
-  int name_size;
-
-  if (flags & GRN_OBJ_PERSISTENT) {
-    table_name = "Users";
-    table_name_size = strlen(table_name);
-  }
-  key_type = get_object("ShortText");
-  table = grn_table_create(context,
-                           table_name, table_name_size, NULL,
-                           flags,
-                           key_type, NULL);
-  grn_obj_set_info(context, table, GRN_INFO_NORMALIZER,
-                   get_object("NormalizerASCII"));
-  normalizer = grn_obj_get_info(context, table, GRN_INFO_NORMALIZER, NULL);
-  name_size = grn_obj_name(context, normalizer, name, sizeof(name));
-  name[name_size] = '\0';
-  cut_assert_equal_string("NormalizerASCII", name);
-}
-




Groonga-commit メーリングリストの案内
Back to archive index