diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-06-09 09:21:37 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1999-06-09 09:21:37 +0000 |
commit | c1241cd2ed230573bb81b52173d6cd2bd91176f2 (patch) | |
tree | caa3babd9a35b930814fffa9c8ebb3366d46dae8 /string.c | |
parent | 17ae11ca25d210da8c7deeeee0f03fd1a09ee0b2 (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.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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); } |