diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-21 12:42:01 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-21 12:42:01 +0000 |
commit | b6f664686ec1ab617e84abb13197b17e953ad55c (patch) | |
tree | ba282fb8f05bd29e802ebc8739903f9a1e550b17 /ext | |
parent | ff3e585014f6388636fbc2a57800fadce3b99219 (diff) | |
download | ruby-b6f664686ec1ab617e84abb13197b17e953ad55c.tar.gz |
* ext/bigdecimal/bigdecimal.c (VpAlloc): Fix the expr to adjust the size
of the digit array.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 53efafd24b..533333228a 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -3816,7 +3816,9 @@ VpAlloc(size_t mx, const char *szVal) size_t mf = VpGetPrecLimit(); VALUE buf; - mx = (mx + BASE_FIG - 1) / BASE_FIG + 1; /* Determine allocation unit. */ + mx = (mx + BASE_FIG - 1) / BASE_FIG; /* Determine allocation unit. */ + if (mx == 0) ++mx; + if (szVal) { while (ISSPACE(*szVal)) szVal++; if (*szVal != '#') { |