static grn_rc grn_plugin_call_register(grn_ctx *ctx, grn_id id) { grn_plugin *plugin; int size; CRITICAL_SECTION_ENTER(grn_plugins_lock); size = grn_hash_get_value(&grn_plugins_ctx, grn_plugins, id, &plugin); CRITICAL_SECTION_LEAVE(grn_plugins_lock); if (size == 0) { return GRN_INVALID_ARGUMENT; } #ifdef GRN_WITH_MRUBY if (!plugin->dl) { return grn_plugin_call_register_mrb(ctx, id, plugin); } #endif /* GRN_WITH_MRUBY */ if (plugin->register_func) { return plugin->register_func(ctx); } return GRN_SUCCESS; }
static grn_rc grn_plugin_call_register(grn_ctx *ctx, grn_id id) { grn_plugin *plugin; if (!grn_hash_get_value(&grn_gctx, grn_plugins, id, &plugin)) { return GRN_INVALID_ARGUMENT; } #ifdef GRN_WITH_MRUBY if (!plugin->dl) { return grn_plugin_call_register_mrb(ctx, id, plugin); } #endif /* GRN_WITH_MRUBY */ if (plugin->register_func) { return plugin->register_func(ctx); } return GRN_SUCCESS; }