Kouhei Sutou
null+****@clear*****
Wed Oct 1 21:19:59 JST 2014
Kouhei Sutou 2014-10-01 21:19:59 +0900 (Wed, 01 Oct 2014) New Revision: aaa91073b42545b3a4e2cd5cc947f459d7ffba4d https://github.com/groonga/groonga/commit/aaa91073b42545b3a4e2cd5cc947f459d7ffba4d Merged fec9865: Merge pull request #209 from groonga/support-token-filters Message: Add space to keep token filters key tables Modified files: lib/dat.cpp lib/dat.h lib/hash.c lib/hash.h lib/pat.c lib/pat.h Modified: lib/dat.cpp (+5 -1) =================================================================== --- lib/dat.cpp 2014-10-01 20:56:10 +0900 (de34297) +++ lib/dat.cpp 2014-10-01 21:19:59 +0900 (fa418e2) @@ -1,5 +1,5 @@ /* -*- c-basic-offset: 2 -*- */ -/* Copyright(C) 2011-2012 Brazil +/* Copyright(C) 2011-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -113,6 +113,7 @@ grn_dat_init(grn_ctx *, grn_dat *dat) dat->old_trie = NULL; dat->tokenizer = NULL; dat->normalizer = NULL; + GRN_PTR_INIT(&(dat->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); CRITICAL_SECTION_INIT(dat->lock); } @@ -128,6 +129,7 @@ grn_dat_fin(grn_ctx *ctx, grn_dat *dat) grn_io_close(ctx, dat->io); dat->io = NULL; } + GRN_OBJ_FIN(ctx, &(dat->token_filters)); } /* @@ -313,6 +315,7 @@ grn_dat_create(grn_ctx *ctx, const char *path, uint32_t, } dat->encoding = encoding; dat->tokenizer = NULL; + GRN_PTR_INIT(&(dat->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); dat->obj.header.flags = dat->header->flags; @@ -355,6 +358,7 @@ grn_dat_open(grn_ctx *ctx, const char *path) } else { dat->normalizer = grn_ctx_at(ctx, dat->header->normalizer); } + GRN_PTR_INIT(&(dat->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); dat->obj.header.flags = dat->header->flags; return dat; } Modified: lib/dat.h (+2 -1) =================================================================== --- lib/dat.h 2014-10-01 20:56:10 +0900 (00c71df) +++ lib/dat.h 2014-10-01 21:19:59 +0900 (d0c44b7) @@ -1,5 +1,5 @@ /* -*- c-basic-offset: 2 -*- */ -/* Copyright(C) 2011 Brazil +/* Copyright(C) 2011-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -37,6 +37,7 @@ struct _grn_dat { void *old_trie; grn_obj *tokenizer; grn_obj *normalizer; + grn_obj token_filters; grn_critical_section lock; }; Modified: lib/hash.c (+6 -0) =================================================================== --- lib/hash.c 2014-10-01 20:56:10 +0900 (7940284) +++ lib/hash.c 2014-10-01 21:19:59 +0900 (fa5854a) @@ -1609,6 +1609,7 @@ grn_io_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path, hash->normalizer = NULL; header->normalizer = GRN_ID_NIL; } + GRN_PTR_INIT(&(hash->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); grn_table_queue_init(ctx, &header->queue); hash->obj.header.flags = header->flags; @@ -1683,6 +1684,7 @@ grn_tiny_hash_init(grn_ctx *ctx, grn_hash *hash, const char *path, hash->garbages = GRN_ID_NIL; hash->tokenizer = NULL; hash->normalizer = NULL; + GRN_PTR_INIT(&(hash->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); grn_tiny_array_init(ctx, &hash->a, entry_size, GRN_TINY_ARRAY_CLEAR); grn_tiny_bitmap_init(ctx, &hash->bitmap); return GRN_SUCCESS; @@ -1755,6 +1757,7 @@ grn_hash_open(grn_ctx *ctx, const char *path) } else { hash->normalizer = grn_ctx_at(ctx, header->normalizer); } + GRN_PTR_INIT(&(hash->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); hash->obj.header.flags = header->flags; return hash; } else { @@ -1779,6 +1782,8 @@ grn_tiny_hash_fin(grn_ctx *ctx, grn_hash *hash) return GRN_INVALID_ARGUMENT; } + GRN_OBJ_FIN(ctx, &(hash->token_filters)); + if (hash->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) { uint32_t num_remaining_entries = *hash->n_entries; grn_id *hash_ptr; @@ -1808,6 +1813,7 @@ grn_hash_close(grn_ctx *ctx, grn_hash *hash) if (!ctx || !hash) { return GRN_INVALID_ARGUMENT; } if (grn_hash_is_io_hash(hash)) { rc = grn_io_close(ctx, hash->io); + GRN_PTR_INIT(&(hash->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); } else { GRN_ASSERT(ctx == hash->ctx); rc = grn_tiny_hash_fin(ctx, hash); Modified: lib/hash.h (+1 -0) =================================================================== --- lib/hash.h 2014-10-01 20:56:10 +0900 (59cdec1) +++ lib/hash.h 2014-10-01 21:19:59 +0900 (6f2e68d) @@ -206,6 +206,7 @@ struct _grn_hash { uint32_t *max_offset; grn_obj *tokenizer; grn_obj *normalizer; + grn_obj token_filters; /* For grn_io_hash. */ grn_io *io; Modified: lib/pat.c (+4 -1) =================================================================== --- lib/pat.c 2014-10-01 20:56:10 +0900 (4ca2ffc) +++ lib/pat.c 2014-10-01 21:19:59 +0900 (5b03e61) @@ -1,5 +1,5 @@ /* -*- c-basic-offset: 2 -*- */ -/* Copyright(C) 2009-2012 Brazil +/* Copyright(C) 2009-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -432,6 +432,7 @@ _grn_pat_create(grn_ctx *ctx, grn_pat *pat, pat->normalizer = NULL; header->normalizer = GRN_ID_NIL; } + GRN_PTR_INIT(&(pat->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); pat->io = io; pat->header = header; pat->key_size = key_size; @@ -533,6 +534,7 @@ grn_pat_open(grn_ctx *ctx, const char *path) } else { pat->normalizer = grn_ctx_at(ctx, header->normalizer); } + GRN_PTR_INIT(&(pat->token_filters), GRN_OBJ_VECTOR, GRN_ID_NIL); pat->obj.header.flags = header->flags; PAT_AT(pat, 0, node0); if (!node0) { @@ -552,6 +554,7 @@ grn_pat_close(grn_ctx *ctx, grn_pat *pat) if ((rc = grn_io_close(ctx, pat->io))) { ERR(rc, "grn_io_close failed"); } else { + GRN_OBJ_FIN(ctx, &(pat->token_filters)); if (pat->cache) { grn_pat_cache_disable(ctx, pat); } GRN_FREE(pat); } Modified: lib/pat.h (+2 -1) =================================================================== --- lib/pat.h 2014-10-01 20:56:10 +0900 (09e1fa8) +++ lib/pat.h 2014-10-01 21:19:59 +0900 (d2d1032) @@ -1,5 +1,5 @@ /* -*- c-basic-offset: 2 -*- */ -/* Copyright(C) 2009 Brazil +/* Copyright(C) 2009-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -39,6 +39,7 @@ struct _grn_pat { uint32_t value_size; grn_obj *tokenizer; grn_obj *normalizer; + grn_obj token_filters; grn_id *cache; uint32_t cache_size; }; -------------- next part -------------- HTML����������������������������... Télécharger