From db5265a82c221887faf0dfd0d04e47cf11a08e3a Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 11 Apr 2012 13:31:23 +0000 Subject: * 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 --- README.EXT | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'README.EXT') diff --git a/README.EXT b/README.EXT index ad45255bca..8368a94708 100644 --- a/README.EXT +++ b/README.EXT @@ -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 -- cgit v1.2.3