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

ruby-changes:32936

From: mrkn <ko1@a...>
Date: Mon, 17 Feb 2014 02:14:16 +0900 (JST)
Subject: [ruby-changes:32936] mrkn:r45015 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.

mrkn	2014-02-17 02:14:11 +0900 (Mon, 17 Feb 2014)

  New Revision: 45015

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

  Log:
    * ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.
    
    * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/ext/bigdecimal/bigdecimal.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45014)
+++ ChangeLog	(revision 45015)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Feb 17 02:12:00 2014  Kenta Murata  <mrkn@m...>
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.
+
+	* ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto.
+
 Sun Feb 16 15:53:36 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* test/test_securerandom.rb: File.exists? is deprecated. use File.exist?
Index: ext/bigdecimal/bigdecimal.c
===================================================================
--- ext/bigdecimal/bigdecimal.c	(revision 45014)
+++ ext/bigdecimal/bigdecimal.c	(revision 45015)
@@ -2467,9 +2467,11 @@ static Real *BigDecimal_new(int argc, VA https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2467
 static VALUE
 BigDecimal_initialize(int argc, VALUE *argv, VALUE self)
 {
+    ENTER(1);
     Real *pv = rb_check_typeddata(self, &BigDecimal_data_type);
-    Real *x = BigDecimal_new(argc, argv);
+    Real *x;
 
+    GUARD_OBJ(x, BigDecimal_new(argc, argv));
     if (ToValue(x)) {
 	pv = VpCopy(pv, x);
     }
@@ -2548,7 +2550,10 @@ BigDecimal_new(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2550
 static VALUE
 BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
 {
-    Real *pv = BigDecimal_new(argc, argv);
+    ENTER(1);
+    Real *pv;
+
+    GUARD_OBJ(pv, BigDecimal_new(argc, argv));
     if (ToValue(pv)) pv = VpCopy(NULL, pv);
     pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
     return pv->obj;

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

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