diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-13 09:23:56 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-13 09:23:56 +0000 |
commit | 83a01e6f529b80a876508b9501b64e8f1f1414da (patch) | |
tree | 1b0d55e85fdb3db68d6361084c24a3f9dfecec93 | |
parent | 19f9d30249ca33755ad1b64a2ab3cdcacecce89b (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
-rw-r--r-- | string.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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) { |