summaryrefslogtreecommitdiffstats
path: root/bignum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-27 09:53:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-12-27 09:53:54 +0000
commit6ae12f4b08c0914e7e5b03c8d2c6a3d3a6aa0fb6 (patch)
treea0be2c7231ea12bd1b234b3fe724dbf1ea65adee /bignum.c
parent27970e3b0099370f4147317f5acb7b0297b0dd23 (diff)
downloadruby-6ae12f4b08c0914e7e5b03c8d2c6a3d3a6aa0fb6.tar.gz
ruby-6ae12f4b08c0914e7e5b03c8d2c6a3d3a6aa0fb6.tar.xz
ruby-6ae12f4b08c0914e7e5b03c8d2c6a3d3a6aa0fb6.zip
* bignum.c (rb_cstr2inum): deny "0_".
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/bignum.c b/bignum.c
index 3b62b2844..38513c237 100644
--- a/bignum.c
+++ b/bignum.c
@@ -241,18 +241,9 @@ rb_cstr2inum(str, base)
}
len = 4;
}
- if (*str == '0') {
- do str++; while (*str == '0');
- if (!*str) return INT2FIX(0);
- while (*str == '_') str++;
- if (!*str) str--;
- if (ISSPACE(*str)) {
- if (badcheck) {
- while (ISSPACE(*str)) str++;
- if (*str) goto bad;
- }
- return INT2FIX(0);
- }
+ if (*str == '0') { /* squeeze preceeding 0s */
+ while (*++str == '0');
+ --str;
}
len *= strlen(str)*sizeof(char);