[Groonga-commit] groonga/groonga at 4002ef7 [master] Add dynamic mruby enabled check

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Mar 14 22:54:33 JST 2015


Kouhei Sutou	2015-03-14 22:54:33 +0900 (Sat, 14 Mar 2015)

  New Revision: 4002ef75814c2a92cb8c1760089e374a453b23ba
  https://github.com/groonga/groonga/commit/4002ef75814c2a92cb8c1760089e374a453b23ba

  Message:
    Add dynamic mruby enabled check
    
    GitHub: fix #302
    
    Reported by Masafumi Yokoyama. Thanks!!!

  Modified files:
    lib/plugin.c

  Modified: lib/plugin.c (+9 -0)
===================================================================
--- lib/plugin.c    2015-03-13 18:13:02 +0900 (c3ca5f3)
+++ lib/plugin.c    2015-03-14 22:54:33 +0900 (e2efaeb)
@@ -254,6 +254,11 @@ grn_plugin_open_mrb(grn_ctx *ctx, const char *filename, size_t filename_size)
   grn_id id = GRN_ID_NIL;
   grn_plugin **plugin = NULL;
 
+  if (!ctx->impl->mrb.state) {
+    ERR(GRN_FUNCTION_NOT_IMPLEMENTED, "mruby support isn't enabled");
+    return GRN_ID_NIL;
+  }
+
   id = grn_hash_add(&grn_gctx, grn_plugins, filename, filename_size,
                     (void **)&plugin, NULL);
   if (!id) {
@@ -529,6 +534,10 @@ grn_plugin_find_path_mrb(grn_ctx *ctx, const char *path, size_t path_len)
   const char *mrb_suffix = grn_plugin_mrb_suffix;
   size_t mrb_path_len;
 
+  if (!ctx->impl->mrb.state) {
+    return NULL;
+  }
+
   mrb_path_len = path_len + strlen(mrb_suffix);
   if (mrb_path_len >= PATH_MAX) {
     ERR(GRN_FILENAME_TOO_LONG,
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index