[Groonga-commit] groonga/groonga [master] Don't assume that we can use fixed ID for normalizers

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Dec 29 14:49:40 JST 2012


Kouhei Sutou	2012-12-29 14:49:40 +0900 (Sat, 29 Dec 2012)

  New Revision: 1e3ab2055991e1834f087b409294f0180a1a8d28
  https://github.com/groonga/groonga/commit/1e3ab2055991e1834f087b409294f0180a1a8d28

  Log:
    Don't assume that we can use fixed ID for normalizers
    
    We can't use fixed ID for normalizers when we open a database that is
    created by old groonga.

  Modified files:
    include/groonga.h
    lib/db.c
    lib/normalizer.c

  Modified: include/groonga.h (+0 -6)
===================================================================
--- include/groonga.h    2012-12-29 14:47:54 +0900 (e1908b9)
+++ include/groonga.h    2012-12-29 14:49:40 +0900 (cf25deb)
@@ -610,12 +610,6 @@ typedef enum {
   GRN_DB_TRIGRAM
 } grn_builtin_tokenizer;
 
-typedef enum {
-  GRN_DB_NORMALIZER_AUTO = 96,
-  GRN_DB_NORMALIZER_NFKC51,          /* Normalization Form KC for Unicode 5.1 */
-  GRN_DB_NORMALIZER_UCA              /* Unicode Collation Algorithm */
-} grn_builtin_normalizer;
-
 GRN_API grn_obj *grn_ctx_at(grn_ctx *ctx, grn_id id);
 
 /**

  Modified: lib/db.c (+0 -4)
===================================================================
--- lib/db.c    2012-12-29 14:47:54 +0900 (83f5716)
+++ lib/db.c    2012-12-29 14:49:40 +0900 (9bdbda8)
@@ -8504,10 +8504,6 @@ grn_db_init_builtin_types(grn_ctx *ctx)
   }
 #endif
   grn_db_init_builtin_tokenizers(ctx);
-  for (id = grn_db_curr_id(ctx, db) + 1; id < GRN_DB_NORMALIZER_AUTO; id++) {
-    grn_itoh(id, buf + 3, 2);
-    grn_obj_register(ctx, db, buf, 5);
-  }
   grn_db_init_builtin_normalizers(ctx);
   for (id = grn_db_curr_id(ctx, db) + 1; id < 128; id++) {
     grn_itoh(id, buf + 3, 2);

  Modified: lib/normalizer.c (+2 -10)
===================================================================
--- lib/normalizer.c    2012-12-29 14:47:54 +0900 (ecd30f0)
+++ lib/normalizer.c    2012-12-29 14:49:40 +0900 (3dc6a0c)
@@ -1174,18 +1174,10 @@ grn_normalizer_normalize(grn_ctx *ctx, grn_obj *normalizer, grn_obj *string)
 grn_rc
 grn_db_init_builtin_normalizers(grn_ctx *ctx)
 {
-  grn_rc rc;
   const char *normalizer_nfkc51_name = "NormalizerNFKC51";
 
-  rc = grn_normalizer_register(ctx, GRN_NORMALIZER_AUTO_NAME, -1,
-                               NULL, auto_next, NULL);
-  if (rc == GRN_SUCCESS) {
-    grn_obj *obj;
-    obj = grn_ctx_get(ctx, normalizer_auto_name, -1);
-    if (!obj || ((grn_db_obj *)obj)->id != GRN_DB_NORMALIZER_AUTO) {
-      return GRN_FILE_CORRUPT;
-    }
-  }
+  grn_normalizer_register(ctx, GRN_NORMALIZER_AUTO_NAME, -1,
+                          NULL, auto_next, NULL);
 
 #ifdef WITH_NFKC
   grn_normalizer_register(ctx, normalizer_nfkc51_name, -1,
-------------- next part --------------
HTML����������������������������...
Download 



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