diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-24 18:32:46 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-08-26 08:58:02 +0900 |
commit | 00ac3a64ba57ecd8f10bf54f03297cdec0c538d6 (patch) | |
tree | db4c230a17629f0e8996ffa01c300088a8305efe /io.c | |
parent | cfdbbd67268a77177e485263cdd8fb416315e9a6 (diff) |
Introduce `at_char_boundary` function
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8296
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -4144,8 +4144,7 @@ rb_io_getline_0(VALUE rs, long limit, int chomp, rb_io_t *fptr) s = RSTRING_PTR(str); e = RSTRING_END(str); p = e - rslen; - pp = rb_enc_left_char_head(s, p, e, enc); - if (pp != p) continue; + if (!at_char_boundary(s, p, e, enc)) continue; if (!rspara) rscheck(rsptr, rslen, rs); if (memcmp(p, rsptr, rslen) == 0) { if (chomp) { |