From 1a64d45c67feed7355d6b53746801acb319394a4 Mon Sep 17 00:00:00 2001 From: S-H-GAMELINKS Date: Tue, 15 Nov 2022 13:21:45 +0900 Subject: Introduce encoding check macro --- io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index e4caaaca81..3b40950aa0 100644 --- a/io.c +++ b/io.c @@ -1646,7 +1646,7 @@ make_writeconv(rb_io_t *fptr) ecflags = fptr->encs.ecflags & ~ECONV_NEWLINE_DECORATOR_READ_MASK; ecopts = fptr->encs.ecopts; - if (!fptr->encs.enc || (fptr->encs.enc == rb_ascii8bit_encoding() && !fptr->encs.enc2)) { + if (!fptr->encs.enc || (rb_is_ascii8bit_enc(fptr->encs.enc) && !fptr->encs.enc2)) { /* no encoding conversion */ fptr->writeconv_pre_ecflags = 0; fptr->writeconv_pre_ecopts = Qnil; @@ -6514,7 +6514,7 @@ rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc, ext = rb_default_external_encoding(); default_ext = 1; } - if (ext == rb_ascii8bit_encoding()) { + if (rb_is_ascii8bit_enc(ext)) { /* If external is ASCII-8BIT, no transcoding */ intern = NULL; } -- cgit v1.2.3