|
78 | 78 | VALUE rb_cString;
|
79 | 79 | VALUE rb_cSymbol;
|
80 | 80 |
|
81 |
| -/* FLAGS of RString |
| 81 | +/* Flags of RString |
82 | 82 | *
|
83 | 83 | * 1: RSTRING_NOEMBED
|
84 |
| - * 2: STR_SHARED (== ELTS_SHARED) |
85 |
| - * 5: STR_SHARED_ROOT (RSTRING_NOEMBED==1 && STR_SHARED == 0, there may be |
86 |
| - * other strings that rely on this string's buffer) |
87 |
| - * 6: STR_BORROWED (when RSTRING_NOEMBED==1 && klass==0, unsafe to recycle |
88 |
| - * early, specific to rb_str_tmp_frozen_{acquire,release}) |
89 |
| - * 7: STR_TMPLOCK (set when a pointer to the buffer is passed to syscall |
90 |
| - * such as read(2). Any modification and realloc is prohibited) |
91 |
| - * |
92 |
| - * 8-9: ENC_CODERANGE (2 bits) |
93 |
| - * 10-16: ENCODING (7 bits == 128) |
| 84 | + * The string is not embedded. When a string is embedded, the contents |
| 85 | + * follow the header. When a string is not embedded, the contents is |
| 86 | + * on a separately allocated buffer. |
| 87 | + * 2: STR_SHARED (equal to ELTS_SHARED) |
| 88 | + * The string is shared. The buffer this string points to is owned by |
| 89 | + * another string (the shared root). |
| 90 | + * 5: STR_SHARED_ROOT |
| 91 | + * Other strings may point to the contents of this string. When this |
| 92 | + * flag is set, STR_SHARED must not be set. |
| 93 | + * 6: STR_BORROWED |
| 94 | + * When RSTRING_NOEMBED is set and klass is 0, this string is unsafe |
| 95 | + * to be unshared by rb_str_tmp_frozen_release. |
| 96 | + * 7: STR_TMPLOCK |
| 97 | + * The pointer to the buffer is passed to a system call such as |
| 98 | + * read(2). Any modification and realloc is prohibited. |
| 99 | + * 8-9: ENC_CODERANGE |
| 100 | + * Stores the coderange of the string. |
| 101 | + * 10-16: ENCODING |
| 102 | + * Stores the encoding of the string. |
94 | 103 | * 17: RSTRING_FSTR
|
95 |
| - * 18: STR_NOFREE (do not free this string's buffer when a String is freed. |
96 |
| - * used for a string object based on C string literal) |
97 |
| - * 19: STR_FAKESTR (when RVALUE is not managed by GC. Typically, the string |
98 |
| - * object header is temporarily allocated on C stack) |
| 104 | + * The string is a fstring. The string is deduplicated in the fstring |
| 105 | + * table. |
| 106 | + * 18: STR_NOFREE |
| 107 | + * Do not free this string's buffer when the string is reclaimed |
| 108 | + * by the garbage collector. Used for when the string buffer is a C |
| 109 | + * string literal. |
| 110 | + * 19: STR_FAKESTR |
| 111 | + * The string is not allocated or managed by the garbage collector. |
| 112 | + * Typically, the string object header (struct RString) is temporarily |
| 113 | + * allocated on C stack. |
99 | 114 | */
|
100 | 115 |
|
101 | 116 | #define RUBY_MAX_CHAR_LEN 16
|
|
0 commit comments