Skip to content

Commit 6336431

Browse files
committed
[DOC] rb_id2name(): Note truncation danger (+minor copyediting)
Thanks, nobu!
1 parent 827accc commit 6336431

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

include/ruby/internal/symbol.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,13 @@ ID rb_intern_str(VALUE str);
121121
* Retrieves the name mapped to the given id.
122122
*
123123
* @param[in] id An id to query.
124-
* @retval NULL No such id ever existed in the history.
124+
* @retval NULL Unknown id.
125125
* @retval otherwise A name that the id represents.
126126
* @note The return value is managed by the interpreter. Don't pass it
127127
* to free().
128+
* @note The underlying name can contain internal NUL bytes, so the return
129+
* value might be a truncated representation due to the nature of C
130+
* strings.
128131
* @note This C string is backed by an underlying Ruby string. The Ruby
129132
* string may move during GC compaction which would make this
130133
* C string point to invalid memory. Do not use the return value

0 commit comments

Comments
 (0)