* parse.y (rb_check_id_cstr): new function to check if ID is

registered with NUL-terminated C string.
* sprintf.c (rb_str_format): avoid inadvertent symbol creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-04-11 13:31:23 +00:00
parent a5d1da5d74
commit db5265a82c
7 changed files with 58 additions and 5 deletions

View file

@ -452,12 +452,14 @@ argument by using
rb_to_id(VALUE symbol)
rb_check_id(volatile VALUE *name)
rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
These functions try to convert the argument to a String if it was not
a Symbol nor a String. The latter function stores the converted
a Symbol nor a String. The second function stores the converted
result into *name, and returns 0 if the string is not a known symbol.
After this function returned a non-zero value, *name is always a
Symbol or a String, otherwise it is a String if the result is 0.
The third function takes NUL-terminated C string, not Ruby VALUE.
You can convert C ID to Ruby Symbol by using