diff --git a/include/groonga/plugin.h b/include/groonga/plugin.h index c7f265bc83..94ed076710 100644 --- a/include/groonga/plugin.h +++ b/include/groonga/plugin.h @@ -151,6 +151,14 @@ void grn_plugin_mutex_lock(grn_ctx *ctx, grn_plugin_mutex *mutex); */ void grn_plugin_mutex_unlock(grn_ctx *ctx, grn_plugin_mutex *mutex); +/* + grn_plugin_proc_alloc() allocates a `grn_obj` object. + You can use it in function that is registered as GRN_PROC_FUNCTION. + */ +grn_obj *grn_plugin_proc_alloc(grn_ctx *ctx, grn_user_data *user_data, + grn_id domain, grn_obj_flags flags); + + #ifdef __cplusplus } #endif diff --git a/lib/plugin.c b/lib/plugin.c index a91a709ab5..20da194ede 100644 --- a/lib/plugin.c +++ b/lib/plugin.c @@ -523,3 +523,10 @@ grn_plugin_mutex_unlock(grn_ctx *ctx, grn_plugin_mutex *mutex) CRITICAL_SECTION_LEAVE(mutex->critical_section); } } + +grn_obj * +grn_plugin_proc_alloc(grn_ctx *ctx, grn_user_data *user_data, + grn_id domain, grn_obj_flags flags) +{ + return grn_proc_alloc(ctx, user_data, domain, flags); +} diff --git a/plugins/query_expanders/tsv.c b/plugins/query_expanders/tsv.c index ab75c5cadd..2e501a6469 100644 --- a/plugins/query_expanders/tsv.c +++ b/plugins/query_expanders/tsv.c @@ -20,8 +20,6 @@ /* groonga's internal headers: They should be removed. */ /* for grn_text_fgets() */ #include -/* for GRN_PROC_ALLOC() */ -#include /* for grn_win32_base_dir() */ #include @@ -185,7 +183,7 @@ func_query_expander_tsv(grn_ctx *ctx, int nargs, grn_obj **args, rc = GRN_SUCCESS; } - rc_object = GRN_PROC_ALLOC(GRN_DB_INT32, 0); + rc_object = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_INT32, 0); if (rc_object) { GRN_INT32_SET(ctx, rc_object, rc); }