summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-22 09:00:23 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-12-22 09:00:23 +0000
commite6bf7809f399b4602c9b3a2aa4761da0e336fb83 (patch)
treea423ef967d835ff2af929f5912a7c4b66f96166e /bignum.c
parent7f16734d2722ae0a33125bac9c9de5a90dba3e83 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/bignum.c b/bignum.c
index 8a47a449e6..1e847dd7af 100644
--- a/bignum.c
+++ b/bignum.c
@@ -202,32 +202,31 @@ rb_cstr2inum(str, base)
while (*str && ISSPACE(*str)) str++;
- if (*str == '+') {
+ if (str[0] == '+') {
str++;
}
- else if (*str == '-') {
+ else if (str[0] == '-') {
str++;
sign = 0;
}
if (base == 0) {
- if (*str == '0') {
- str++;
- if (*str == 'x' || *str == 'X') {
- str++;
+ if (str[0] == '0') {
+ if (str[1] == 'x' || str[1] == 'X') {
base = 16;
}
- else if (*str == 'b' || *str == 'B') {
- str++;
+ else if (str[1] == 'b' || str[1] == 'B') {
base = 2;
}
else {
base = 8;
- if (!*str) return INT2FIX(0);
+ if (!str[1]) return INT2FIX(0);
}
}
+ else if (str[0] == 0) {
+ return INT2FIX(0);
+ }
else {
base = 10;
- if (!*str) return INT2FIX(0);
}
}
if (base == 8) {