summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-06-09 09:21:37 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-06-09 09:21:37 +0000
commitc1241cd2ed230573bb81b52173d6cd2bd91176f2 (patch)
treecaa3babd9a35b930814fffa9c8ebb3366d46dae8 /string.c
parent17ae11ca25d210da8c7deeeee0f03fd1a09ee0b2 (diff)
thread bugs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/string.c b/string.c
index 4fe1bd5e42..6c094848ef 100644
--- a/string.c
+++ b/string.c
@@ -2439,9 +2439,17 @@ rb_str_oct(str)
{
int base = 8;
- if (RSTRING(str)->len > 2 && RSTRING(str)->ptr[0] == '0' &&
- (RSTRING(str)->ptr[1] == 'x' || RSTRING(str)->ptr[1] == 'X')) {
- base = 16;
+ if (RSTRING(str)->len > 2 && RSTRING(str)->ptr[0] == '0') {
+ switch (RSTRING(str)->ptr[1]) {
+ case 'x':
+ case 'X':
+ base = 16;
+ break;
+ case 'b':
+ case 'B':
+ base = 2;
+ break;
+ }
}
return rb_str2inum(RSTRING(str)->ptr, base);
}