mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_Float): remove underscores between digits.
* bignum.c (rb_cstr2inum): reject prefix followed by spaces only. * class.c (rb_class_inherited): should use Object when no super class. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a2fc17bb81
commit
5fe2879fd5
4 changed files with 23 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
|||
Wed Jan 16 11:12:30 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* object.c (rb_Float): remove underscores between digits.
|
||||
|
||||
* bignum.c (rb_cstr2inum): reject prefix followed by spaces only.
|
||||
|
||||
* class.c (rb_class_inherited): should use Object when no super
|
||||
class.
|
||||
|
||||
Fri Jan 11 05:06:25 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
|
||||
|
||||
* class.c (rb_make_metaclass): [new]
|
||||
|
|
2
bignum.c
2
bignum.c
|
@ -252,8 +252,8 @@ rb_cstr2inum(str, base)
|
|||
|
||||
if (*end == '_') goto bigparse;
|
||||
if (badcheck) {
|
||||
while (*end && ISSPACE(*end)) end++;
|
||||
if (end == str) goto bad; /* no number */
|
||||
while (*end && ISSPACE(*end)) end++;
|
||||
if (*end) { /* trailing garbage */
|
||||
bad:
|
||||
rb_invalid_str(s, "Integer");
|
||||
|
|
1
class.c
1
class.c
|
@ -170,6 +170,7 @@ VALUE
|
|||
rb_class_inherited(super, klass)
|
||||
VALUE super, klass;
|
||||
{
|
||||
if (!super) super = rb_cObject;
|
||||
return rb_funcall(super, rb_intern("inherited"), 1, klass);
|
||||
}
|
||||
|
||||
|
|
17
object.c
17
object.c
|
@ -966,7 +966,6 @@ rb_Float(val)
|
|||
|
||||
q = p = StringValuePtr(val);
|
||||
while (*p && ISSPACE(*p)) p++;
|
||||
again:
|
||||
d = strtod(p, &end);
|
||||
if (p == end) {
|
||||
bad:
|
||||
|
@ -975,12 +974,19 @@ rb_Float(val)
|
|||
if (*end) {
|
||||
if (*end == '_') {
|
||||
char *buf = ALLOCA_N(char, strlen(p));
|
||||
char *n = buf, *last;
|
||||
char *n = buf, *last = p;
|
||||
|
||||
while (p < end) *n++ = *p++;
|
||||
while (*p) {
|
||||
if (*p == '_') {
|
||||
if (*p == '_' && (n > buf && ISDIGIT(n[-1]))) {
|
||||
/* remove underscores between digits */
|
||||
last = ++p;
|
||||
continue;
|
||||
while (*p == '_') ++p;
|
||||
if (!ISDIGIT(*p)) {
|
||||
while (last < p) *n++ = *last++;
|
||||
continue;
|
||||
}
|
||||
last = p;
|
||||
}
|
||||
*n++ = *p++;
|
||||
}
|
||||
|
@ -989,7 +995,8 @@ rb_Float(val)
|
|||
if (!*last) goto bad;
|
||||
*n = '\0';
|
||||
p = buf;
|
||||
goto again;
|
||||
d = strtod(p, &end);
|
||||
if (p == end) goto bad;
|
||||
}
|
||||
while (*end && ISSPACE(*end)) end++;
|
||||
if (*end) goto bad;
|
||||
|
|
Loading…
Reference in a new issue