Kouhei Sutou
null+****@clear*****
Tue Nov 20 10:10:12 JST 2012
Kouhei Sutou 2012-11-20 10:10:12 +0900 (Tue, 20 Nov 2012) New Revision: 5bf5ef1b9825d133de7056ff0cc3820a66a0d028 https://github.com/groonga/groonga/commit/5bf5ef1b9825d133de7056ff0cc3820a66a0d028 Log: tokenizer: add grn_tokenizer_query_{open,close}() Because API consistency. open/close pair is used for creating/freeing object in groonga. grn_tokenizer_query_{create,destroy}() were deprecated. Modified files: include/groonga/tokenizer.h lib/tokenizer.c Modified: include/groonga/tokenizer.h (+16 -2) =================================================================== --- include/groonga/tokenizer.h 2012-11-20 10:05:12 +0900 (3f270df) +++ include/groonga/tokenizer.h 2012-11-20 10:10:12 +0900 (7e51239) @@ -81,20 +81,34 @@ struct _grn_tokenizer_query { }; /* - grn_tokenizer_query_create() parses `args' and returns a new object of + grn_tokenizer_query_open() parses `args' and returns a new object of grn_tokenizer_query. The new object stores information of the query. grn_tokenizer_query_create() normalizes the query if the target table requires normalization. grn_tokenizer_query_create() returns NULL if something goes wrong. Note that grn_tokenizer_query_create() must be called just once in the function that initializes a tokenizer. */ +grn_tokenizer_query *grn_tokenizer_query_open(grn_ctx *ctx, + int num_args, grn_obj **args); + +/* + grn_tokenizer_query_create() is deprecated. Use grn_tokenizer_query_open() + instead. +*/ + grn_tokenizer_query *grn_tokenizer_query_create(grn_ctx *ctx, int num_args, grn_obj **args); /* - grn_tokenizer_mutex_destroy() finalizes an object of grn_tokenizer_mutex + grn_tokenizer_query_close() finalizes an object of grn_tokenizer_query and then frees memory allocated for that object. */ +void grn_tokenizer_query_close(grn_ctx *ctx, grn_tokenizer_query *query); + +/* + grn_tokenizer_query_destroy() is deprecated. Use grn_tokenizer_query_close() + instead. + */ void grn_tokenizer_query_destroy(grn_ctx *ctx, grn_tokenizer_query *query); /* Modified: lib/tokenizer.c (+14 -2) =================================================================== --- lib/tokenizer.c 2012-11-20 10:05:12 +0900 (7bbcf7b) +++ lib/tokenizer.c 2012-11-20 10:10:12 +0900 (6ec9887) @@ -132,7 +132,7 @@ grn_tokenizer_have_tokenized_delimiter(grn_ctx *ctx, } grn_tokenizer_query * -grn_tokenizer_query_create(grn_ctx *ctx, int num_args, grn_obj **args) +grn_tokenizer_query_open(grn_ctx *ctx, int num_args, grn_obj **args) { grn_obj *query_str = grn_ctx_pop(ctx); if (query_str == NULL) { @@ -197,8 +197,14 @@ grn_tokenizer_query_create(grn_ctx *ctx, int num_args, grn_obj **args) } } +grn_tokenizer_query * +grn_tokenizer_query_create(grn_ctx *ctx, int num_args, grn_obj **args) +{ + return grn_tokenizer_query_open(ctx, num_args, args); +} + void -grn_tokenizer_query_destroy(grn_ctx *ctx, grn_tokenizer_query *query) +grn_tokenizer_query_close(grn_ctx *ctx, grn_tokenizer_query *query) { if (query != NULL) { if (query->normalized_query != NULL) { @@ -212,6 +218,12 @@ grn_tokenizer_query_destroy(grn_ctx *ctx, grn_tokenizer_query *query) } void +grn_tokenizer_query_destroy(grn_ctx *ctx, grn_tokenizer_query *query) +{ + grn_tokenizer_query_close(ctx, query); +} + +void grn_tokenizer_token_init(grn_ctx *ctx, grn_tokenizer_token *token) { GRN_TEXT_INIT(&token->str, GRN_OBJ_DO_SHALLOW_COPY); -------------- next part -------------- HTML����������������������������... 下載