summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--bignum.c25
-rw-r--r--version.h4
3 files changed, 20 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c36eb928b..124f27a95d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Dec 27 01:54:02 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
+
+ * bignum.c (rb_cstr2inum): allow "0\n" and so on.
+
Tue Dec 25 02:37:49 2001 Tanaka Akira <akr@m17n.org>
* lib/pp.rb, lib/prettyprint.rb: new files.
diff --git a/bignum.c b/bignum.c
index 5f8d48534f..3b62b28442 100644
--- a/bignum.c
+++ b/bignum.c
@@ -230,10 +230,7 @@ rb_cstr2inum(str, base)
}
}
if (base == 8) {
- while (*str == '0') str++;
- if (!*str) return INT2FIX(0);
- while (*str == '_') str++;
- len = 3*strlen(str)*sizeof(char);
+ len = 3;
}
else { /* base == 10, 2 or 16 */
if (base == 16 && str[0] == '0' && (str[1] == 'x'||str[1] == 'X')) {
@@ -242,14 +239,22 @@ rb_cstr2inum(str, base)
else if (base == 2 && str[0] == '0' && (str[1] == 'b'||str[1] == 'B')) {
str += 2;
}
- while (*str && *str == '0') str++;
+ 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) goto bad;
+ if (badcheck) {
+ while (ISSPACE(*str)) str++;
+ if (*str) goto bad;
+ }
return INT2FIX(0);
}
- if (!*str) str--;
- len = 4*strlen(str)*sizeof(char);
}
+ len *= strlen(str)*sizeof(char);
if (len <= (sizeof(VALUE)*CHAR_BIT)) {
unsigned long val = strtoul((char*)str, &end, base);
@@ -330,9 +335,7 @@ rb_cstr2inum(str, base)
if (badcheck) {
str--;
if (s+1 < str && str[-1] == '_') goto bad;
- if (ISSPACE(c)) {
- while (*str && ISSPACE(*str)) str++;
- }
+ while (*str && ISSPACE(*str)) str++;
if (*str) goto bad;
}
diff --git a/version.h b/version.h
index 9aa417c444..f27d5269be 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.7.2"
-#define RUBY_RELEASE_DATE "2001-12-21"
+#define RUBY_RELEASE_DATE "2001-12-26"
#define RUBY_VERSION_CODE 172
-#define RUBY_RELEASE_CODE 20011221
+#define RUBY_RELEASE_CODE 20011226