Added comments to rb_setup_fake_str and rb_fstring_new [ci skip]
`ptr` for these functions must refer constant string literals. Otherwise, the result string's content can be modified/discarded unexpectedly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
19f9d30249
commit
83a01e6f52
8
string.c
8
string.c
@ -368,12 +368,20 @@ setup_fake_str(struct RString *fake_str, const char *name, long len, int encidx)
|
||||
return (VALUE)fake_str;
|
||||
}
|
||||
|
||||
/*
|
||||
* set up a fake string which refers a static string literal.
|
||||
*/
|
||||
VALUE
|
||||
rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc)
|
||||
{
|
||||
return setup_fake_str(fake_str, name, len, rb_enc_to_index(enc));
|
||||
}
|
||||
|
||||
/*
|
||||
* rb_fstring_new and rb_fstring_cstr family create or lookup a frozen
|
||||
* shared string which refers a static string literal. `ptr` must
|
||||
* point a constant string.
|
||||
*/
|
||||
MJIT_FUNC_EXPORTED VALUE
|
||||
rb_fstring_new(const char *ptr, long len)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user