diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-20 04:44:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-20 04:44:36 +0000 |
commit | cc1e89b0ffa5d0649e2326b1f1f4019e284129cd (patch) | |
tree | f2a23f73e26d084a976786561c2b3cdcdce59ec7 /include | |
parent | 48c7d979b908fd41c54c77ca5094d5dcd0a6f7d9 (diff) | |
download | ruby-cc1e89b0ffa5d0649e2326b1f1f4019e284129cd.tar.gz ruby-cc1e89b0ffa5d0649e2326b1f1f4019e284129cd.tar.xz ruby-cc1e89b0ffa5d0649e2326b1f1f4019e284129cd.zip |
* encoding.c (rb_enc_fast_mbclen): faster mbclen for strings known
to be valid.
* string.c (enc_strlen): coderange specified version of
rb_enc_strlen(). use rb_enc_fast_mbclen() if coderange is 7bit
or valid.
* string.c (str_gsub): use rb_enc_fast_mbclen().
* string.c (rb_str_reverse, rb_str_split_m, rb_str_each_char,
scan_once): ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@23495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/encoding.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h index 4f6608cb1..9be412ddf 100644 --- a/include/ruby/encoding.h +++ b/include/ruby/encoding.h @@ -112,6 +112,9 @@ rb_encoding * rb_enc_find(const char *name); /* -> mbclen (no error notification: 0 < ret <= e-p, no exception) */ int rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc); +/* -> mbclen (only for valid encoding) */ +int rb_enc_fast_mbclen(const char *p, const char *e, rb_encoding *enc); + /* -> chlen, invalid or needmore */ int rb_enc_precise_mbclen(const char *p, const char *e, rb_encoding *enc); #define MBCLEN_CHARFOUND_P(ret) ONIGENC_MBCLEN_CHARFOUND_P(ret) |