mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c: Special-case :ascii option in rb_str_upcase_bang.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f0fc6ec872
commit
5eb73eeda8
2 changed files with 9 additions and 6 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Jun 8 21:57:41 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* string.c: Special-case :ascii option in rb_str_upcase_bang.
|
||||
|
||||
Wed Jun 8 21:28:36 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* string.c: New static function rb_str_ascii_casemap; special-casing
|
||||
|
|
11
string.c
11
string.c
|
@ -5871,7 +5871,6 @@ static VALUE
|
|||
rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
|
||||
{
|
||||
rb_encoding *enc;
|
||||
int modify = 0;
|
||||
OnigCaseFoldType flags = ONIGENC_CASE_UPCASE;
|
||||
|
||||
flags = check_case_options(argc, argv, flags);
|
||||
|
@ -5887,17 +5886,17 @@ rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
|
|||
|
||||
if (rb_enc_isascii(c, enc) && 'a' <= c && c <= 'z') {
|
||||
*s = 'A' + (c - 'a');
|
||||
modify = 1;
|
||||
flags |= ONIGENC_CASE_MODIFIED;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (flags&ONIGENC_CASE_ASCII_ONLY)
|
||||
rb_str_ascii_casemap(str, &flags, enc);
|
||||
else
|
||||
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
|
||||
modify = ONIGENC_CASE_MODIFIED & flags;
|
||||
}
|
||||
|
||||
if (modify) return str;
|
||||
if (ONIGENC_CASE_MODIFIED&flags) return str;
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue