[前][次][番号順一覧][スレッド一覧]

ruby-changes:73505

From: S-H-GAMELINKS <ko1@a...>
Date: Sat, 10 Sep 2022 09:33:03 +0900 (JST)
Subject: [ruby-changes:73505] 79f50b9d02 (master): Using is_broken_string function

https://git.ruby-lang.org/ruby.git/commit/?id=79f50b9d02

From 79f50b9d02b228aba2d8887422f00767046051a6 Mon Sep 17 00:00:00 2001
From: S-H-GAMELINKS <gamelinks007@g...>
Date: Sat, 10 Sep 2022 02:00:34 +0900
Subject: Using is_broken_string function

---
 file.c      | 4 ++--
 marshal.c   | 2 +-
 transcode.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/file.c b/file.c
index eb5851de7d..de7ed5e33b 100644
--- a/file.c
+++ b/file.c
@@ -4500,9 +4500,9 @@ rb_check_realpath_internal(VALUE basedir, VALUE path, rb_encoding *origenc, enum https://github.com/ruby/ruby/blob/trunk/file.c#L4500
         rb_enc_associate(resolved, origenc);
     }
 
-    if (rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) {
+    if (is_broken_string(resolved)) {
         rb_enc_associate(resolved, rb_filesystem_encoding());
-        if (rb_enc_str_coderange(resolved) == ENC_CODERANGE_BROKEN) {
+        if (is_broken_string(resolved)) {
             rb_enc_associate(resolved, rb_ascii8bit_encoding());
         }
     }
diff --git a/marshal.c b/marshal.c
index 9e2f1c4381..e4b40c0607 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1554,7 +1554,7 @@ r_symreal(struct load_arg *arg, int ivar) https://github.com/ruby/ruby/blob/trunk/marshal.c#L1554
     }
     if (idx > 0) {
         rb_enc_associate_index(s, idx);
-        if (rb_enc_str_coderange(s) == ENC_CODERANGE_BROKEN) {
+        if (is_broken_string(s)) {
             rb_raise(rb_eArgError, "invalid byte sequence in %s: %+"PRIsVALUE,
                      rb_enc_name(rb_enc_from_index(idx)), s);
         }
diff --git a/transcode.c b/transcode.c
index 535e436b03..e315a8f1ab 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2590,7 +2590,7 @@ rb_econv_prepare_options(VALUE opthash, VALUE *opts, int ecflags) https://github.com/ruby/ruby/blob/trunk/transcode.c#L2590
     v = rb_hash_aref(opthash, sym_replace);
     if (!NIL_P(v)) {
         StringValue(v);
-        if (rb_enc_str_coderange(v) == ENC_CODERANGE_BROKEN) {
+        if (is_broken_string(v)) {
             VALUE dumped = rb_str_dump(v);
             rb_raise(rb_eArgError, "replacement string is broken: %s as %s",
                      StringValueCStr(dumped),
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]