diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | README.EXT | 6 | ||||
-rw-r--r-- | README.EXT.ja | 8 | ||||
-rw-r--r-- | include/ruby/ruby.h | 5 | ||||
-rw-r--r-- | object.c | 11 |
5 files changed, 11 insertions, 26 deletions
@@ -1,3 +1,10 @@ +Sat Jan 31 22:29:05 2009 Tanaka Akira <[email protected]> + + * include/ruby/ruby.h (STR2CSTR): removed. + (rb_str2cstr): removed. + + * object.c (rb_str2cstr): removed. + Sat Jan 31 20:07:59 2009 Tanaka Akira <[email protected]> * ext/socket/raddrinfo.c (addrinfo_ipv6_unspecified_p): new method. diff --git a/README.EXT b/README.EXT index edfbf221a6..b720fba3a4 100644 --- a/README.EXT +++ b/README.EXT @@ -103,7 +103,7 @@ numbers into C integers. These macros includes a type check, so an exception will be raised if the conversion failed. NUM2DBL() can be used to retrieve the double float value in the same way. -In version 1.7 or later it is recommended that you use the new macros +You can use the macros StringValue() and StringValuePtr() to get a char* from a VALUE. StringValue(var) replaces var's value with the result of "var.to_str()". StringValuePtr(var) does same replacement and returns char* @@ -118,10 +118,6 @@ the ArgumentError exception. StringValuePtr() doesn't gurantee to exist nul at the end of the result, and the result may contain nul. -In version 1.6 or earlier, STR2CSTR() was used to do the same thing -but now it is deprecated in version 1.7, because STR2CSTR() has a risk -of a dangling pointer problem in the to_str() implicit conversion. - Other data types have corresponding C structures, e.g. struct RArray for T_ARRAY etc. The VALUE of the type which has the corresponding structure can be cast to retrieve the pointer to the struct. The diff --git a/README.EXT.ja b/README.EXT.ja index 9a8a4fd610..a4c8447d13 100644 --- a/README.EXT.ja +++ b/README.EXT.ja @@ -115,11 +115,9 @@ FIXNUM��NIL�˴ؤ��ƤϤ���®��Ƚ�̥ޥ������Ѱդ���Ƥ��ޤ��� (�������Ѵ��Ǥ��ʤ����ˤ��㳰��ȯ������)��Ʊ�ͤ˥����å�̵ �ǻȤ����Ѵ��ޥ�����double����Ф���NUM2DBL()�פ�����ޤ��� -char* ����Ф���硤version 1.6 �����Ǥϡ�STR2CSTR()�פȤ� -���ޥ�����ȤäƤ��ޤ������������ to_str() �ˤ����ۤη��� -����̤� GC ������ǽ�������뤿�ᡤversion 1.7 �ʹߤǤ� -obsolete �Ȥʤꡤ����� StringValue() �� StringValuePtr() -��Ȥ�����侩���Ƥ��ޤ���StringValue(var) �� var �� String +char* ����Ф���硤 StringValue() �� StringValuePtr() +��Ȥ��ޤ��� +StringValue(var) �� var �� String �Ǥ���в��⤻���������Ǥʤ���� var �� var.to_str() �η�� ���֤�������ޥ�����StringValuePtr(var) ��Ʊ�ͤ� var �� String ���֤������Ƥ��� var �ΥХ�����ɽ�����Ф��� char* �� diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index b88737838d..1dcff00a6a 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -515,11 +515,6 @@ ULONG2NUM(unsigned long v) return rb_uint2big(v); } -/* obsolete API - use StringValue() */ -char *rb_str2cstr(VALUE,long*); -/* obsolete API - use StringValuePtr() */ -#define STR2CSTR(x) rb_str2cstr((VALUE)(x),0) - #define NUM2CHR(x) (((TYPE(x) == T_STRING)&&(RSTRING_LEN(x)>=1))?\ RSTRING_PTR(x)[0]:(char)(NUM2INT(x)&0xff)) #define CHR2FIX(x) INT2FIX((long)((x)&0xff)) @@ -2304,17 +2304,6 @@ rb_num2dbl(VALUE val) return RFLOAT_VALUE(rb_Float(val)); } -char* -rb_str2cstr(VALUE str, long *len) -{ - StringValue(str); - if (len) *len = RSTRING_LEN(str); - else if (RTEST(ruby_verbose) && RSTRING_LEN(str) != strlen(RSTRING_PTR(str))) { - rb_warn("string contains \\0 character"); - } - return RSTRING_PTR(str); -} - VALUE rb_String(VALUE val) { |