なかだです。

At Tue, 11 Jun 2002 20:19:56 +0900,
Takaaki Tateishi wrote:
> At Tue, 11 Jun 2002 19:51:39 +0900,
> U.Nakamura <usa / osb.att.ne.jp> wrote:
> > 特に、dl.cのはバグだと思いますです。
> 
> ありがとうございます.修正しました.

これを読むまで気づいてませんでしたが、STR2CSTR()はobsoleteです。

ついでに、別ディレクトリでコンパイルするとmake testできません。


Index: depend =================================================================== RCS file: /cvs/ruby/src/ruby/ext/dl/depend,v retrieving revision 1.4 diff -u -2 -p -r1.4 depend --- depend 2002/06/11 01:27:47 1.4 +++ depend 2002/06/11 08:39:49 @@ -6,5 +6,5 @@ LDSHARED_TEST = $(LDSHARED) $(LDFLAGS) t libtest.so: test/libtest.so -test/libtest.so: test/test.o test/libtest.def +test/libtest.so: test/test.o $(srcdir)/test/libtest.def $(RUBY) -rftools -e 'ARGV.each do|d|File.mkpath(File.dirname(d))end' $@ $(LDSHARED_TEST:dl.def=test/libtest.def) Index: dl.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/dl/dl.c,v retrieving revision 1.8 diff -u -2 -p -r1.8 dl.c --- dl.c 2002/06/11 01:27:47 1.8 +++ dl.c 2002/06/11 12:07:31 @@ -582,6 +582,6 @@ rb_dl_callback(int argc, VALUE argv[], V } - Check_Type(type, T_STRING); - switch( STR2CSTR(type)[0] ){ + StringValue(type); + switch( RSTRING(type)->ptr[0] ){ case '0': rettype = 0x00; @@ -609,5 +609,5 @@ rb_dl_callback(int argc, VALUE argv[], V break; default: - rb_raise(rb_eDLTypeError, "unsupported type `%s'", STR2CSTR(rettype)); + rb_raise(rb_eDLTypeError, "unsupported type `%s'", RSTRING(type)->ptr[0]); } @@ -627,5 +627,5 @@ rb_dl_callback(int argc, VALUE argv[], V rb_assoc_new(type,proc)); sprintf(fname, "rb_dl_callback_func_%d_%d", rettype, entry); - return rb_dlsym_new((void (*)())rb_dl_callback_table[rettype][entry], fname, STR2CSTR(type)); + return rb_dlsym_new((void (*)())rb_dl_callback_table[rettype][entry], fname, RSTRING(type)->ptr); } Index: mkcallback.rb =================================================================== RCS file: /cvs/ruby/src/ruby/ext/dl/mkcallback.rb,v retrieving revision 1.2 diff -u -2 -p -r1.2 mkcallback.rb --- mkcallback.rb 2002/06/09 17:47:33 1.2 +++ mkcallback.rb 2002/06/11 12:05:51 @@ -34,5 +34,5 @@ def mkfunc(rettype, fnum, argc) " proto = rb_ary_entry(obj, 0);", " proc = rb_ary_entry(obj, 1);", - " rb_dl_scan_callback_args(buff, STR2CSTR(proto), &argc, &argv);", + " rb_dl_scan_callback_args(buff, StringValuePtr(proto), &argc, _((VALUE (*)[]))&argv);", " retval = rb_funcall2(proc, id_call, argc, argv);", "",
-- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦