Skip to content

Commit

Permalink
Use rb_str_conv_enc for simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 10, 2024
1 parent e90b447 commit 979543e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 979543e

Please sign in to comment.