* 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
This commit is contained in:
matz 2008-09-18 11:21:34 +00:00
Родитель 4046a1cb92
Коммит bc9c077400
2 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);