summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 09:23:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-13 09:23:56 +0000
commit83a01e6f529b80a876508b9501b64e8f1f1414da (patch)
tree1b0d55e85fdb3db68d6361084c24a3f9dfecec93 /string.c
parent19f9d30249ca33755ad1b64a2ab3cdcacecce89b (diff)
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
Diffstat (limited to 'string.c')
-rw-r--r--string.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/string.c b/string.c
index b3dba9c76f..67f4a3c165 100644
--- a/string.c
+++ b/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)
{