From c60ce13a12782ae8a6acfb5d781e5ea1cfb412fa Mon Sep 17 00:00:00 2001 From: shyouhei Date: Tue, 8 Jun 2010 07:49:18 +0000 Subject: merge revision(s) 27665: * ext/bigdecimal/bigdecimal.c (VpAlloc): ensure buf does not get collected. based on a patch masaya tarui at [ruby-dev:41213]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@28217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/bigdecimal/bigdecimal.c | 5 +++-- version.h | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ecc0fe893e..f537887fea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jun 8 16:42:48 2010 Nobuyoshi Nakada + + * ext/bigdecimal/bigdecimal.c (VpAlloc): ensure buf does not get + collected. based on a patch masaya tarui at [ruby-dev:41213]. + Tue Jun 8 16:08:00 2010 Shugo Maeda * lib/net/imap.rb (fetch_internal): do not quote message data item diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 317b171548..7846c0d771 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -2506,7 +2506,7 @@ VpAlloc(U_LONG mx, const char *szVal) int sign=1; Real *vp = NULL; U_LONG mf = VpGetPrecLimit(); - volatile VALUE buf; + VALUE buf; mx = (mx + BASE_FIG - 1) / BASE_FIG + 1; /* Determine allocation unit. */ if(szVal) { @@ -2534,7 +2534,7 @@ VpAlloc(U_LONG mx, const char *szVal) /* Skip all '_' after digit: 2006-6-30 */ ni = 0; - buf = rb_str_new(0,strlen(szVal)+1); + buf = rb_str_tmp_new(strlen(szVal)+1); psz = RSTRING_PTR(buf); i = 0; ipn = 0; @@ -2633,6 +2633,7 @@ VpAlloc(U_LONG mx, const char *szVal) vp->MaxPrec = mx; /* set max precision */ VpSetZero(vp,sign); VpCtoV(vp, &(szVal[ipn]), ni, &(szVal[ipf]), nf, &(szVal[ipe]), ne); + rb_str_resize(buf, 0); return vp; } diff --git a/version.h b/version.h index 8673ddae35..3de10a07d8 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2010-06-08" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20100608 -#define RUBY_PATCHLEVEL 281 +#define RUBY_PATCHLEVEL 282 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 -- cgit v1.2.3