ruby-changes:52846
From: nobu <ko1@a...>
Date: Sat, 13 Oct 2018 18:24:01 +0900 (JST)
Subject: [ruby-changes:52846] nobu:r65058 (trunk): Added comments to rb_setup_fake_str and rb_fstring_new [ci skip]
nobu 2018-10-13 18:23:56 +0900 (Sat, 13 Oct 2018) New Revision: 65058 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65058 Log: 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. Modified files: trunk/string.c Index: string.c =================================================================== --- string.c (revision 65057) +++ string.c (revision 65058) @@ -368,12 +368,20 @@ setup_fake_str(struct RString *fake_str, https://github.com/ruby/ruby/blob/trunk/string.c#L368 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) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/