From e9b5878c4168ec6b5ed5129d897ee9be7636ca71 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 26 Mar 2003 07:01:14 +0000 Subject: * eval.c (avalue_splat): new function to do unary * (splat) operator. * eval.c (avalue_to_svalue,svalue_to_avalue,svalue_to_mrhs): do not use implicit "to_ary" conversion. * ext/curses/curses.c (GetWINDOW,GetMOUSE): add taint check. * ext/curses/curses.c (curses_init_screen): ditto. * ext/curses/curses.c (window_initialize): ditto. * gc.c (os_each_obj): prohibit ObjectSpace#each_object in safe mode ($SAFE >= 4). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- README.EXT | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'README.EXT') diff --git a/README.EXT b/README.EXT index 4bbe1202e6..97e57934be 100644 --- a/README.EXT +++ b/README.EXT @@ -94,9 +94,20 @@ The T_FIXNUM data is a 31bit length fixed integer (63bit length on some machines), which can be convert to a C integer by using the FIX2INT() macro. There is also NUM2INT() which converts any Ruby numbers into C integers. The NUM2INT() macro includes a type check, so -an exception will be raised if the conversion failed. There are also -a macro NUM2DBL() to retrieve the double float value and STR2CSTR() is -useful to get the string as char*. +an exception will be raised if the conversion failed. NUM2DBL() can +be used to retrieve the double float value in same way. + +To get char* from a VALUE, version 1.7 recommend to use new macros +StringValue() and StringValuePtr(). StringValue(var) replaces var's +value to the result of "var.to_str()". StringValuePtr(var) does same +replacement and returns char* representation of var. These macros +will skip the replacement if var is a String. Notice that the macros +requires to take only lvalue as their argument, to change the value +of var in the replacement. + +In version 1.6 or earlier, STR2CSTR() was used to do same thing +but now it is obsoleted in version 1.7 because of STR2CSTR() has +a risk of dangling pointer problem in to_str() impliclit conversion. Other data types have corresponding C structures, e.g. struct RArray for T_ARRAY etc. The VALUE of the type which has corresponding structure -- cgit v1.2.1