downcase_single/upcase_single: assume ASCII
These functions assume ASCII compatibility. That has to be ensured in their caller.
This commit is contained in:
parent
5c167a9778
commit
499660b04f
Notes:
git
2021-10-05 14:18:46 +09:00
6
string.c
6
string.c
@ -6897,9 +6897,8 @@ upcase_single(VALUE str)
|
||||
|
||||
while (s < send) {
|
||||
unsigned int c = *(unsigned char*)s;
|
||||
const rb_encoding *const enc = 0;
|
||||
|
||||
if (rb_enc_isascii(c, enc) && 'a' <= c && c <= 'z') {
|
||||
if ('a' <= c && c <= 'z') {
|
||||
*s = 'A' + (c - 'a');
|
||||
modified = true;
|
||||
}
|
||||
@ -6988,9 +6987,8 @@ downcase_single(VALUE str)
|
||||
|
||||
while (s < send) {
|
||||
unsigned int c = *(unsigned char*)s;
|
||||
const rb_encoding *const enc = 0;
|
||||
|
||||
if (rb_enc_isascii(c, enc) && 'A' <= c && c <= 'Z') {
|
||||
if ('A' <= c && c <= 'Z') {
|
||||
*s = 'a' + (c - 'A');
|
||||
modified = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user