summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-29 17:21:30 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-29 17:21:30 +0000
commit1ff2d59ebb8146c37501c94696acf125ab2c6eb6 (patch)
tree37849b891f87e16b4b5ea06248135d5f28fd83ed /rational.c
parent0caeba64c30e6746870328a0d7da6250b0a3773c (diff)
merge revision(s) r45793: [Backport #9608]
* complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END [Bug #9608] * rational.c (read_digits): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/rational.c b/rational.c
index 53bc11c4ef..33d2a2c2d6 100644
--- a/rational.c
+++ b/rational.c
@@ -2167,13 +2167,14 @@ read_digits(const char **s, int strict,
{
char *b, *bb;
int us = 1, ret = 1;
+ VALUE tmp;
if (!isdecimal(**s)) {
*num = ZERO;
return 0;
}
- bb = b = ALLOCA_N(char, strlen(*s) + 1);
+ bb = b = ALLOCV_N(char, tmp, strlen(*s) + 1);
while (isdecimal(**s) || **s == '_') {
if (**s == '_') {
@@ -2200,6 +2201,7 @@ read_digits(const char **s, int strict,
conv:
*b = '\0';
*num = rb_cstr_to_inum(bb, 10, 0);
+ ALLOCV_END(tmp);
return ret;
}