Introduce at_char_boundary function

This commit is contained in:
Nobuyoshi Nakada 2023-08-24 18:32:46 +09:00
parent cfdbbd6726
commit 00ac3a64ba
Notes: git 2023-08-25 23:58:23 +00:00
4 changed files with 12 additions and 8 deletions

3
io.c
View file

@ -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) {