summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-12-11 01:13:15 +0900
committerNobuyoshi Nakada <[email protected]>2024-12-11 01:13:15 +0900
commit979543e7bf2d25a49aff8f267a077ff7e9ff3f9c (patch)
treeea71228489ebbdbfadba396becd438c46280ccaf /io.c
parente90b447655dd39ad1eb645cdaae450efd605db00 (diff)
Use `rb_str_conv_enc` for simplicity
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index cf507a6fba..eb56094296 100644
--- a/io.c
+++ b/io.c
@@ -4188,7 +4188,7 @@ rb_io_getline_0(VALUE rs, long limit, int chomp, rb_io_t *fptr)
rs = 0;
if (!rb_enc_asciicompat(enc)) {
rs = rb_usascii_str_new(rsptr, rslen);
- rs = rb_str_encode(rs, rb_enc_from_encoding(enc), 0, Qnil);
+ rs = rb_str_conv_enc(rs, 0, enc);
OBJ_FREEZE(rs);
rsptr = RSTRING_PTR(rs);
rslen = RSTRING_LEN(rs);
@@ -4200,7 +4200,7 @@ rb_io_getline_0(VALUE rs, long limit, int chomp, rb_io_t *fptr)
newline = (unsigned char)rsptr[rslen - 1];
}
else {
- rs = rb_str_encode(rs, rb_enc_from_encoding(enc), 0, Qnil);
+ rs = rb_str_conv_enc(rs, 0, enc);
rsptr = RSTRING_PTR(rs);
const char *e = rsptr + rslen;
const char *last = rb_enc_prev_char(rsptr, e, e, enc);