зеркало из https://github.com/github/ruby.git
* string.c: Special-case :ascii option in rb_str_upcase_bang (retry).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e695cdffbc
Коммит
13f576d6b9
|
@ -1,3 +1,7 @@
|
|||
Fri Jun 10 17:12:24 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* string.c: Special-case :ascii option in rb_str_upcase_bang (retry).
|
||||
|
||||
Fri Jun 10 14:48:36 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* hash.c (get_env_cstr): ensure NUL-terminated.
|
||||
|
|
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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче