summaryrefslogtreecommitdiff
path: root/bignum.c
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 /bignum.c
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
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c3
1 files changed, 3 insertions, 0 deletions
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);