[Groonga-commit] groonga/groonga [master] Add a wrapper of grn_proc_alloc() for plugin

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Oct 11 18:04:22 JST 2012


Kouhei Sutou	2012-10-11 18:04:22 +0900 (Thu, 11 Oct 2012)

  New Revision: 3314fa9333be5e24d3be3dbe664a7d6e3fb6580c
  https://github.com/groonga/groonga/commit/3314fa9333be5e24d3be3dbe664a7d6e3fb6580c

  Log:
    Add a wrapper of grn_proc_alloc() for plugin
    
    grn_plugin_proc_alloc() is added.

  Modified files:
    include/groonga/plugin.h
    lib/plugin.c
    plugins/query_expanders/tsv.c

  Modified: include/groonga/plugin.h (+8 -0)
===================================================================
--- include/groonga/plugin.h    2012-10-11 17:58:02 +0900 (c7f265b)
+++ include/groonga/plugin.h    2012-10-11 18:04:22 +0900 (94ed076)
@@ -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

  Modified: lib/plugin.c (+7 -0)
===================================================================
--- lib/plugin.c    2012-10-11 17:58:02 +0900 (a91a709)
+++ lib/plugin.c    2012-10-11 18:04:22 +0900 (20da194)
@@ -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);
+}

  Modified: plugins/query_expanders/tsv.c (+1 -3)
===================================================================
--- plugins/query_expanders/tsv.c    2012-10-11 17:58:02 +0900 (ab75c5c)
+++ plugins/query_expanders/tsv.c    2012-10-11 18:04:22 +0900 (2e501a6)
@@ -20,8 +20,6 @@
 /* groonga's internal headers: They should be removed. */
 /* for grn_text_fgets() */
 #include <str.h>
-/* for GRN_PROC_ALLOC() */
-#include <db.h>
 /* for grn_win32_base_dir() */
 #include <util.h>
 
@@ -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);
   }
-------------- next part --------------
HTML����������������������������...
Download 



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