Kouhei Sutou
null+****@clear*****
Tue Nov 13 13:04:38 JST 2012
Kouhei Sutou 2012-11-13 13:04:38 +0900 (Tue, 13 Nov 2012) New Revision: 3dc431f80d85f5ea99b939c578cdaa3eacbdfa81 https://github.com/groonga/groonga/commit/3dc431f80d85f5ea99b939c578cdaa3eacbdfa81 Log: Don't use if (...) try {...} catch {} else {...} It is confused syntax. Modified files: plugins/tokenizers/kytea.cpp Modified: plugins/tokenizers/kytea.cpp (+8 -6) =================================================================== --- plugins/tokenizers/kytea.cpp 2012-11-13 11:27:41 +0900 (87b37d3) +++ plugins/tokenizers/kytea.cpp 2012-11-13 13:04:38 +0900 (b2746c2) @@ -169,7 +169,14 @@ grn_obj *grn_kytea_init(grn_ctx *ctx, int num_args, grn_obj **args, grn_tokenizer_kytea * const tokenizer = static_cast<grn_tokenizer_kytea *>( GRN_PLUGIN_MALLOC(ctx, sizeof(grn_tokenizer_kytea))); - if (tokenizer != NULL) try { + if (!tokenizer) { + grn_tokenizer_query_destroy(ctx, query); + GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE, + "[tokenizer] memory allocation to grn_tokenizer_kytea failed"); + return NULL; + } + + try { grn_tokenizer_kytea_init(ctx, tokenizer); tokenizer->query = query; } catch (...) { @@ -177,11 +184,6 @@ grn_obj *grn_kytea_init(grn_ctx *ctx, int num_args, grn_obj **args, GRN_PLUGIN_ERROR(ctx, GRN_TOKENIZER_ERROR, "[tokenizer] tokenizer initialization failed"); return NULL; - } else { - grn_tokenizer_query_destroy(ctx, query); - GRN_PLUGIN_ERROR(ctx, GRN_NO_MEMORY_AVAILABLE, - "[tokenizer] memory allocation to grn_tokenizer_kytea failed"); - return NULL; } grn_plugin_mutex_lock(ctx, kytea_mutex); -------------- next part -------------- HTML����������������������������...다운로드