[Groonga-commit] groonga/groonga at 1accd4a [master] mrb: implement free function for Groonga::TableGroupResult

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 29 14:59:44 JST 2015


Kouhei Sutou	2015-06-29 14:59:44 +0900 (Mon, 29 Jun 2015)

  New Revision: 1accd4ac37473ad875f82302e1c706b6b4514755
  https://github.com/groonga/groonga/commit/1accd4ac37473ad875f82302e1c706b6b4514755

  Message:
    mrb: implement free function for Groonga::TableGroupResult

  Modified files:
    lib/mrb/mrb_table_group_result.c

  Modified: lib/mrb/mrb_table_group_result.c (+21 -2)
===================================================================
--- lib/mrb/mrb_table_group_result.c    2015-06-29 11:32:50 +0900 (6f3ffd8)
+++ lib/mrb/mrb_table_group_result.c    2015-06-29 14:59:44 +0900 (a58e7f8)
@@ -29,9 +29,28 @@
 #include "mrb_ctx.h"
 #include "mrb_table_group_result.h"
 
+static void
+mrb_grn_table_group_result_free(mrb_state *mrb, void *data)
+{
+  grn_ctx *ctx = (grn_ctx *)mrb->ud;
+  grn_table_group_result *result = data;
+
+  if (!result) {
+    return;
+  }
+
+  if (result->calc_target) {
+    grn_obj_unlink(ctx, result->calc_target);
+  }
+  if (result->table) {
+    grn_obj_unlink(ctx, result->table);
+  }
+  mrb_free(mrb, result);
+}
+
 static struct mrb_data_type mrb_grn_table_group_result_type = {
   "Groonga::TableGroupResult",
-  mrb_free
+  mrb_grn_table_group_result_free
 };
 
 static mrb_value
@@ -55,7 +74,7 @@ mrb_grn_table_group_result_close(mrb_state *mrb, mrb_value self)
 
   result = DATA_PTR(self);
   if (result) {
-    mrb_free(mrb, result);
+    mrb_grn_table_group_result_free(mrb, result);
     DATA_PTR(self) = NULL;
   }
 
-------------- next part --------------
HTML����������������������������...
Download 



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