* rational.c (read_digits): due to a bit tighter rb_cstr_to_inum().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
15648bfda8
commit
1ac4e6d274
@ -1,3 +1,7 @@
|
|||||||
|
Wed Nov 21 18:46:37 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* rational.c (read_digits): due to a bit tighter rb_cstr_to_inum().
|
||||||
|
|
||||||
Wed Nov 21 16:13:37 2012 Koichi Sasada <ko1@atdot.net>
|
Wed Nov 21 16:13:37 2012 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* benchmark/bm_so_nsieve_bits.rb: add an encoding pragma because
|
* benchmark/bm_so_nsieve_bits.rb: add an encoding pragma because
|
||||||
|
@ -1986,14 +1986,16 @@ static int
|
|||||||
read_digits(const char **s, int strict,
|
read_digits(const char **s, int strict,
|
||||||
VALUE *num, int *count)
|
VALUE *num, int *count)
|
||||||
{
|
{
|
||||||
|
char *b, *bb;
|
||||||
int us = 1, ret = 1;
|
int us = 1, ret = 1;
|
||||||
const char *b = *s;
|
|
||||||
|
|
||||||
if (!isdecimal(**s)) {
|
if (!isdecimal(**s)) {
|
||||||
*num = ZERO;
|
*num = ZERO;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bb = b = ALLOCA_N(char, strlen(*s) + 1);
|
||||||
|
|
||||||
while (isdecimal(**s) || **s == '_') {
|
while (isdecimal(**s) || **s == '_') {
|
||||||
if (**s == '_') {
|
if (**s == '_') {
|
||||||
if (strict) {
|
if (strict) {
|
||||||
@ -2007,6 +2009,7 @@ read_digits(const char **s, int strict,
|
|||||||
else {
|
else {
|
||||||
if (count)
|
if (count)
|
||||||
(*count)++;
|
(*count)++;
|
||||||
|
*b++ = **s;
|
||||||
us = 0;
|
us = 0;
|
||||||
}
|
}
|
||||||
(*s)++;
|
(*s)++;
|
||||||
@ -2016,7 +2019,8 @@ read_digits(const char **s, int strict,
|
|||||||
(*s)--;
|
(*s)--;
|
||||||
} while (**s == '_');
|
} while (**s == '_');
|
||||||
conv:
|
conv:
|
||||||
*num = rb_cstr_to_inum(b, 10, 0);
|
*b = '\0';
|
||||||
|
*num = rb_cstr_to_inum(bb, 10, 0);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user