mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
* string.c (rb_str_inspect): don't call rb_enc_codepoint with empty
string. fix '#'.inspect. * encoding.c (rb_enc_codepoint): raise on empty string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8e4c6d8482
commit
ead329fd8e
3 changed files with 13 additions and 2 deletions
|
@ -662,7 +662,10 @@ rb_enc_ascget(const char *p, const char *e, int *len, rb_encoding *enc)
|
|||
|
||||
int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc)
|
||||
{
|
||||
int r = rb_enc_precise_mbclen(p, e, enc);
|
||||
int r;
|
||||
if (e <= p)
|
||||
rb_raise(rb_eArgError, "empty string");
|
||||
r = rb_enc_precise_mbclen(p, e, enc);
|
||||
if (MBCLEN_CHARFOUND(r))
|
||||
return ONIGENC_MBC_TO_CODE(enc,(UChar*)p,(UChar*)e);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue