summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-15 00:06:13 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-15 00:06:13 +0000
commit57fb2199059cb55b632d093c2e64c8a3c60acfbb (patch)
treee35e0fb134907d12cee224d3750f4cc00c7b7634 /encoding.c
parentb860144680e3af51f7fc0d7185185a92c4fa6aca (diff)
* reduce UNREACHABLE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/encoding.c b/encoding.c
index f2506b3412..41f217063b 100644
--- a/encoding.c
+++ b/encoding.c
@@ -922,14 +922,11 @@ rb_enc_codepoint_len(const char *p, const char *e, int *len_p, rb_encoding *enc)
if (e <= p)
rb_raise(rb_eArgError, "empty string");
r = rb_enc_precise_mbclen(p, e, enc);
- if (MBCLEN_CHARFOUND_P(r)) {
- if (len_p) *len_p = MBCLEN_CHARFOUND_LEN(r);
- return rb_enc_mbc_to_codepoint(p, e, enc);
- }
- else
+ if (!MBCLEN_CHARFOUND_P(r)) {
rb_raise(rb_eArgError, "invalid byte sequence in %s", rb_enc_name(enc));
-
- UNREACHABLE;
+ }
+ if (len_p) *len_p = MBCLEN_CHARFOUND_LEN(r);
+ return rb_enc_mbc_to_codepoint(p, e, enc);
}
#undef rb_enc_codepoint