1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* regexec.c (ONIGENC_IS_MBC_ASCII_WORD): redefine optimized one.

WORD of Ruby's ascii compatible encoding is always [a-zA-Z0-9_].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2016-05-29 13:58:45 +00:00
parent 9ff5f9c071
commit 267d34c6e8
2 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Sun May 29 22:58:19 2016 NARUSE, Yui <naruse@ruby-lang.org>
* regexec.c (ONIGENC_IS_MBC_ASCII_WORD): redefine optimized one.
WORD of Ruby's ascii compatible encoding is always [a-zA-Z0-9_].
Sun May 29 22:44:19 2016 NARUSE, Yui <naruse@ruby-lang.org>
* regexec.c (match_at): make compilers optimize harder.

View file

@ -40,6 +40,18 @@
# endif
#endif
#define ENC_DUMMY_FLAG (1<<24)
static inline int
rb_enc_asciicompat(OnigEncoding enc)
{
return ONIGENC_MBC_MINLEN(enc)==1 && !((enc)->ruby_encoding_index & ENC_DUMMY_FLAG);
}
#undef ONIGENC_IS_MBC_ASCII_WORD
#define ONIGENC_IS_MBC_ASCII_WORD(enc,s,end) \
(rb_enc_asciicompat(enc) ? (ISALNUM(*s) || *s=='_') : \
onigenc_ascii_is_code_ctype( \
ONIGENC_MBC_TO_CODE(enc,s,end),ONIGENC_CTYPE_WORD,enc))
#ifdef USE_CRNL_AS_LINE_TERMINATOR
#define ONIGENC_IS_MBC_CRNL(enc,p,end) \
(ONIGENC_MBC_TO_CODE(enc,p,end) == 13 && \