summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2021-09-30 15:32:34 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2021-10-05 14:18:23 +0900
commit499660b04f22c0b7203dbd1de31a85443d4290b4 (patch)
tree293da78a490abe6ec3a134337b5aef73a69294ce
parent5c167a9778366c8d348f00debc479777626ef252 (diff)
downcase_single/upcase_single: assume ASCII
These functions assume ASCII compatibility. That has to be ensured in their caller.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4909
-rw-r--r--string.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/string.c b/string.c
index 80f3358c2c..3717493fa1 100644
--- a/string.c
+++ b/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;
}