summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-18 11:21:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-18 11:21:34 +0000
commitbc9c077400d42ba3cecb3da7d60e514f4a645f4b (patch)
tree25873ce502f523c51d167ba468d1e81de5005dc4
parent4046a1cb92094d5227bc98e7e2eec14c08b65652 (diff)
* bignum.c (big2str_karatsuba): free internal buffer eagerly.
a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in [ruby-dev:36217]. * bignum.c (rb_big2str0): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--bignum.c3
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 59a4f43736..7e0d62565a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,14 @@ Thu Sep 18 20:02:48 2008 Yusuke Endoh <mame@tsg.ne.jp>
* lib/uri/common.rb (unescape): skip '%' to make String#hex work
correctly.
+Thu Sep 18 19:51:11 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (big2str_karatsuba): free internal buffer eagerly.
+ a patch from TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com>
+ in [ruby-dev:36217].
+
+ * bignum.c (rb_big2str0): ditto.
+
Thu Sep 18 19:43:04 2008 Yusuke Endoh <mame@tsg.ne.jp>
* st.c (new_size): raise RuntimeError when st_table is too big.
diff --git a/bignum.c b/bignum.c
index e1bbef83da..dc30519b89 100644
--- a/bignum.c
+++ b/bignum.c
@@ -909,8 +909,10 @@ big2str_karatsuba(VALUE x, int base, char* ptr,
bigdivmod(x, b, &q, &r);
lh = big2str_karatsuba(q, base, ptr, (len - m1)/2,
len - m1, hbase, trim);
+ rb_big_resize(q, 0);
ll = big2str_karatsuba(r, base, ptr + lh, m1/2,
m1, hbase, !lh && trim);
+ rb_big_resize(r, 0);
return lh + ll;
}
@@ -953,6 +955,7 @@ rb_big2str0(VALUE x, int base, int trim)
len = off + big2str_karatsuba(xx, base, ptr + off, n1,
n2, hbase, trim);
}
+ rb_big_resize(xx, 0);
ptr[len] = '\0';
rb_str_resize(ss, len);