mirror of
https://github.com/ruby/ruby.git
synced 2025-08-26 22:45:03 +02:00
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
This commit is contained in:
parent
0caeba64c3
commit
1ff2d59ebb
4 changed files with 25 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Jun 30 02:18:47 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
|
||||
|
||||
Mon Jun 30 02:10:34 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vsnprintf.c (BSD_vfprintf): fix string width when precision is
|
||||
|
|
17
complex.c
17
complex.c
|
@ -1774,19 +1774,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;
|
||||
if (!read_comp(&s, strict, num, &b)) {
|
||||
ret = 0;
|
||||
}
|
||||
else {
|
||||
skip_ws(&s);
|
||||
|
||||
if (strict)
|
||||
if (*s != '\0')
|
||||
return 0;
|
||||
return 1;
|
||||
ret = 0;
|
||||
}
|
||||
ALLOCV_END(tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.1.2"
|
||||
#define RUBY_RELEASE_DATE "2014-06-30"
|
||||
#define RUBY_PATCHLEVEL 149
|
||||
#define RUBY_PATCHLEVEL 150
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2014
|
||||
#define RUBY_RELEASE_MONTH 6
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue