[前][次][番号順一覧][スレッド一覧]

ruby-changes:22409

From: nobu <ko1@a...>
Date: Tue, 7 Feb 2012 14:45:15 +0900 (JST)
Subject: [ruby-changes:22409] nobu:r34458 (trunk, ruby_1_9_3): * ext/-test-/st/numhash/numhash.c (numhash_alloc): free st_table.

nobu	2012-02-07 14:43:49 +0900 (Tue, 07 Feb 2012)

  New Revision: 34458

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34458

  Log:
    * ext/-test-/st/numhash/numhash.c (numhash_alloc): free st_table.

  Modified files:
    branches/ruby_1_9_3/ext/-test-/st/numhash/numhash.c
    trunk/ext/-test-/st/numhash/numhash.c

Index: ext/-test-/st/numhash/numhash.c
===================================================================
--- ext/-test-/st/numhash/numhash.c	(revision 34457)
+++ ext/-test-/st/numhash/numhash.c	(revision 34458)
@@ -1,10 +1,16 @@
 #include <ruby.h>
 #include <ruby/st.h>
 
+static void
+numhash_free(void *ptr)
+{
+    if (ptr) st_free_table(ptr);
+}
+
 static VALUE
 numhash_alloc(VALUE klass)
 {
-    return Data_Wrap_Struct(klass, 0, 0, 0);
+    return Data_Wrap_Struct(klass, 0, numhash_free, 0);
 }
 
 static VALUE
Index: ruby_1_9_3/ext/-test-/st/numhash/numhash.c
===================================================================
--- ruby_1_9_3/ext/-test-/st/numhash/numhash.c	(revision 34457)
+++ ruby_1_9_3/ext/-test-/st/numhash/numhash.c	(revision 34458)
@@ -1,10 +1,16 @@
 #include <ruby.h>
 #include <ruby/st.h>
 
+static void
+numhash_free(void *ptr)
+{
+    if (ptr) st_free_table(ptr);
+}
+
 static VALUE
 numhash_alloc(VALUE klass)
 {
-    return Data_Wrap_Struct(klass, 0, 0, 0);
+    return Data_Wrap_Struct(klass, 0, numhash_free, 0);
 }
 
 static VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]