diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | complex.c | 23 | ||||
-rw-r--r-- | rational.c | 4 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 25 insertions, 10 deletions
@@ -1,3 +1,9 @@ +Fri Jun 27 17:12:45 2014 Eric Wong <e@80x24.org> + + * complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END + [Bug #9608] + * rational.c (read_digits): ditto + Fri Jun 27 17:05:23 2014 Tanaka Akira <akr@fsij.org> * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an @@ -1781,19 +1781,26 @@ parse_comp(const char *s, int strict, VALUE *num) { char *buf, *b; + VALUE tmp; + int ret = 1; - buf = ALLOCA_N(char, strlen(s) + 1); + buf = ALLOCV_N(char, tmp, strlen(s) + 1); b = buf; skip_ws(&s); - if (!read_comp(&s, strict, num, &b)) - return 0; - skip_ws(&s); + if (!read_comp(&s, strict, num, &b)) { + ret = 0; + } + else { + skip_ws(&s); - if (strict) - if (*s != '\0') - return 0; - return 1; + if (strict) + if (*s != '\0') + ret = 0; + } + ALLOCV_END(tmp); + + return ret; } static VALUE diff --git a/rational.c b/rational.c index dd5d24dc69..f359665f7f 100644 --- a/rational.c +++ b/rational.c @@ -2070,13 +2070,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 == '_') { @@ -2103,6 +2104,7 @@ read_digits(const char **s, int strict, conv: *b = '\0'; *num = rb_cstr_to_inum(bb, 10, 0); + ALLOCV_END(tmp); return ret; } @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-06-27" -#define RUBY_PATCHLEVEL 502 +#define RUBY_PATCHLEVEL 503 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 6 |