summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ext/bigdecimal/bigdecimal.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e937f0..8f81062 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Feb 17 02:12:00 2014 Kenta Murata <mrkn@mrkn.jp>
+
+ * 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@gmail.com>
* test/test_securerandom.rb: File.exists? is deprecated. use File.exist?
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index c25f3e7..f33dd82 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2467,9 +2467,11 @@ static Real *BigDecimal_new(int argc, VALUE *argv);
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)
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;