summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-16 14:51:38 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-16 14:51:38 +0000
commit02f848f9a48129aca2b372a06a85da0e6c687923 (patch)
tree2f2f4078edee6f615332446ddaa3de62c2a51813 /numeric.c
parenta74375b05f1e0b6b7ff5ab14b230b0818b4f76f2 (diff)
* numeric.c (flo_divmod): protect float values from GC by
assignment to local variables. [ruby-dev:24873] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 6b3c377001..a222bf3401 100644
--- a/numeric.c
+++ b/numeric.c
@@ -731,7 +731,9 @@ flo_divmod(x, y)
return rb_num_coerce_bin(x, y);
}
flodivmod(RFLOAT(x)->value, fy, &div, &mod);
- return rb_assoc_new(rb_float_new(div), rb_float_new(mod));
+ x = rb_float_new(div);
+ y = rb_float_new(mod);
+ return rb_assoc_new(x, y);
}
/*