summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--README.EXT6
-rw-r--r--README.EXT.ja8
-rw-r--r--include/ruby/ruby.h5
-rw-r--r--object.c11
5 files changed, 11 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 582a23cb45..b41214389d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Jan 31 22:29:05 2009 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/ruby.h (STR2CSTR): removed.
+ (rb_str2cstr): removed.
+
+ * object.c (rb_str2cstr): removed.
+
Sat Jan 31 20:07:59 2009 Tanaka Akira <akr@fsij.org>
* 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))
diff --git a/object.c b/object.c
index 6c418d25e2..ab940abe8f 100644
--- a/object.c
+++ b/object.c
@@ -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)
{