From 00ac3a64ba57ecd8f10bf54f03297cdec0c538d6 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 24 Aug 2023 18:32:46 +0900 Subject: Introduce `at_char_boundary` function --- io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 6e27ed6273..bd1db9aa5d 100644 --- a/io.c +++ b/io.c @@ -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) { -- cgit v1.2.3