aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-24 18:32:46 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-26 08:58:02 +0900
commit00ac3a64ba57ecd8f10bf54f03297cdec0c538d6 (patch)
treedb4c230a17629f0e8996ffa01c300088a8305efe /io.c
parentcfdbbd67268a77177e485263cdd8fb416315e9a6 (diff)
downloadruby-00ac3a64ba57ecd8f10bf54f03297cdec0c538d6.tar.gz
Introduce `at_char_boundary` function
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 1 insertions, 2 deletions
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) {