mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Scan the code range of the last added portion
This commit is contained in:
parent
f34280ec6b
commit
99116da7f0
Notes:
git
2022-08-19 03:06:19 +09:00
1 changed files with 4 additions and 2 deletions
|
@ -927,6 +927,10 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
||||||
flags = FNONE;
|
flags = FNONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
|
||||||
|
scanned += rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &coderange);
|
||||||
|
ENC_CODERANGE_SET(result, coderange);
|
||||||
|
}
|
||||||
sprint_exit:
|
sprint_exit:
|
||||||
rb_str_tmp_frozen_release(orig, fmt);
|
rb_str_tmp_frozen_release(orig, fmt);
|
||||||
/* XXX - We cannot validate the number of arguments if (digit)$ style used.
|
/* XXX - We cannot validate the number of arguments if (digit)$ style used.
|
||||||
|
@ -937,8 +941,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
||||||
if (RTEST(ruby_verbose)) rb_warn("%s", mesg);
|
if (RTEST(ruby_verbose)) rb_warn("%s", mesg);
|
||||||
}
|
}
|
||||||
rb_str_resize(result, blen);
|
rb_str_resize(result, blen);
|
||||||
// rb_str_format mutates the string without updating coderange
|
|
||||||
ENC_CODERANGE_CLEAR(result);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue