summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-29 15:29:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-29 15:29:09 +0000
commitcd89edc065296409f55ab15a45c4dd580950829f (patch)
treeb733d13027c4b37a4a78c6b9f9c2a6d35b4f5037 /encoding.c
parent99de7f24f76a0ea1dc61a404a815611801107e0e (diff)
* encoding.c (rb_enc_dummy_p): bootstrap encodings can not be dummy.
* encoding.c (rb_enc_ascget): no needs to call rb_enc_precise_mbclen() twice. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/encoding.c b/encoding.c
index 5c24c98505..92ed9db1d5 100644
--- a/encoding.c
+++ b/encoding.c
@@ -349,7 +349,9 @@ encdb_dummy(const char *name)
int
rb_enc_dummy_p(rb_encoding *enc)
{
- VALUE encoding = rb_enc_from_encoding(enc);
+ VALUE encoding;
+ if (!enc_initialized_p(enc)) return Qfalse;
+ encoding = rb_enc_from_encoding(enc);
return ENC_DUMMY_P(encoding);
}
@@ -772,7 +774,7 @@ rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc)
l = rb_enc_precise_mbclen(p, e, enc);
if (!MBCLEN_CHARFOUND_P(l))
return -1;
- c = rb_enc_codepoint(p, e, enc);
+ c = rb_enc_mbc_to_codepoint(p, e, enc);
if (!rb_enc_isascii(c, enc))
return -1;
if (len) *len = l;