[Bug #19902] Update the coderange regarding the changed region

This commit is contained in:
Nobuyoshi Nakada 2023-09-26 13:25:44 +09:00
parent f0d8278607
commit 6b66b5fded
3 changed files with 66 additions and 0 deletions

View file

@ -7,8 +7,18 @@ bug_str_set_len(VALUE str, VALUE len)
return str;
}
static VALUE
bug_str_append(VALUE str, VALUE addendum)
{
StringValue(addendum);
rb_str_modify_expand(str, RSTRING_LEN(addendum));
memcpy(RSTRING_END(str), RSTRING_PTR(addendum), RSTRING_LEN(addendum));
return str;
}
void
Init_string_set_len(VALUE klass)
{
rb_define_method(klass, "set_len", bug_str_set_len, 1);
rb_define_method(klass, "append", bug_str_append, 1);
}