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

* re.c (rb_reg_prepare_enc): use rb_enc_asciicompat(enc) instead of

rb_enc_str_asciicompat_p(str) to avoid useless rb_enc_get(str) call.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2016-04-28 07:52:59 +00:00
parent 38b756501f
commit 0c4466abba
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Thu Apr 28 16:52:05 2016 NARUSE, Yui <naruse@ruby-lang.org>
* re.c (rb_reg_prepare_enc): use rb_enc_asciicompat(enc) instead of
rb_enc_str_asciicompat_p(str) to avoid useless rb_enc_get(str) call.
Thu Apr 28 16:33:41 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb: [DOC] fix example code. base on the code by

4
re.c
View file

@ -1384,7 +1384,7 @@ rb_reg_prepare_enc(VALUE re, VALUE str, int warn)
rb_reg_check(re);
enc = rb_enc_get(str);
if (!rb_enc_str_asciicompat_p(str)) {
if (!rb_enc_asciicompat(enc)) {
if (RREGEXP_PTR(re)->enc != enc) {
reg_enc_error(re, str);
}
@ -3408,7 +3408,7 @@ rb_reg_s_union(VALUE self, VALUE args0)
rb_encoding *enc;
StringValue(e);
enc = rb_enc_get(e);
if (!rb_enc_str_asciicompat_p(e)) {
if (!rb_enc_asciicompat(enc)) {
if (!has_ascii_incompat)
has_ascii_incompat = enc;
else if (has_ascii_incompat != enc)