[前][次][番号順一覧][スレッド一覧]

ruby-changes:69495

From: Yusuke <ko1@a...>
Date: Fri, 29 Oct 2021 01:57:56 +0900 (JST)
Subject: [ruby-changes:69495] acb2f86caa (master): string.c: Add some comments about STR flags

https://git.ruby-lang.org/ruby.git/commit/?id=acb2f86caa

From acb2f86caa384fd7a32d4fe682b9fa719015c1c7 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Fri, 29 Oct 2021 01:57:29 +0900
Subject: string.c: Add some comments about STR flags

---
 string.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/string.c b/string.c
index b815b12c54d..64f290d62c9 100644
--- a/string.c
+++ b/string.c
@@ -89,12 +89,16 @@ VALUE rb_cSymbol; https://github.com/ruby/ruby/blob/trunk/string.c#L89
  *                         other strings that rely on this string's buffer)
  * 6:     STR_BORROWED (when RSTRING_NOEMBED==1 && klass==0, unsafe to recycle
  *                      early, specific to rb_str_tmp_frozen_{acquire,release})
- * 7:     STR_TMPLOCK
+ * 7:     STR_TMPLOCK (set when a pointer to the buffer is passed to syscall
+ *                     such as read(2). Any modification and realloc is prohibited)
+ *
  * 8-9:   ENC_CODERANGE (2 bits)
  * 10-16: ENCODING (7 bits == 128)
  * 17:    RSTRING_FSTR
- * 18:    STR_NOFREE
- * 19:    STR_FAKESTR
+ * 18:    STR_NOFREE (do not free this string's buffer when a String is freed.
+ *                    used for a string object based on C string literal)
+ * 19:    STR_FAKESTR (when RVALUE is not managed by GC. Typically, the string
+ *                     object header is temporarily allocated on C stack)
  */
 
 #define RUBY_MAX_CHAR_LEN 16
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]