ruby-changes:68260
From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Tue, 5 Oct 2021 14:18:43 +0900 (JST)
Subject: [ruby-changes:68260] 499660b04f (master): downcase_single/upcase_single: assume ASCII
https://git.ruby-lang.org/ruby.git/commit/?id=499660b04f From 499660b04f22c0b7203dbd1de31a85443d4290b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= <shyouhei@r...> Date: Thu, 30 Sep 2021 15:32:34 +0900 Subject: downcase_single/upcase_single: assume ASCII These functions assume ASCII compatibility. That has to be ensured in their caller. --- string.c | 6 ++---- 1 file 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) https://github.com/ruby/ruby/blob/trunk/string.c#L6897 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) https://github.com/ruby/ruby/blob/trunk/string.c#L6987 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; } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/